language
stringlengths 0
24
| filename
stringlengths 9
214
| code
stringlengths 99
9.93M
|
---|---|---|
Patch | aircrack-ng/patches/mac80211_2.6.32.2-wl_frag+ack_radiotap.patch | diff -uNr linux-2.6.32.2/include/net/ieee80211_radiotap.h linux-2.6.32.2-wl_frag-ack/include/net/ieee80211_radiotap.h
--- linux-2.6.32.2/include/net/ieee80211_radiotap.h 2009-12-18 14:27:07.000000000 -0800
+++ linux-2.6.32.2-wl_frag-ack/include/net/ieee80211_radiotap.h 2009-12-19 16:04:22.721448723 -0800
@@ -240,6 +240,9 @@
* retries */
#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
+#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* frame should not be ACKed */
+#define IEEE80211_RADIOTAP_F_TX_NOSEQ 0x0010 /* sequence number handled
+ * by userspace */
/* Ugly macro to convert literal channel numbers into their mhz equivalents
* There are certianly some conditions that will break this (like feeding it '30')
diff -uNr linux-2.6.32.2/net/mac80211/tx.c linux-2.6.32.2-wl_frag-ack/net/mac80211/tx.c
--- linux-2.6.32.2/net/mac80211/tx.c 2009-12-18 14:27:07.000000000 -0800
+++ linux-2.6.32.2-wl_frag-ack/net/mac80211/tx.c 2009-12-19 16:12:31.782448438 -0800
@@ -678,6 +678,10 @@
u8 *qc;
int tid;
+ if (unlikely(!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)))
+ return TX_CONTINUE;
+ info->flags &= ~IEEE80211_TX_CTL_ASSIGN_SEQ;
+
/*
* Packet injection may want to control the sequence
* number, if we have no matching interface then we
@@ -974,6 +978,12 @@
if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
tx->flags |= IEEE80211_TX_FRAGMENTED;
break;
+ case IEEE80211_RADIOTAP_TX_FLAGS:
+ if (*iterator.this_arg & IEEE80211_RADIOTAP_F_TX_NOACK)
+ info->flags |= IEEE80211_TX_CTL_NO_ACK;
+ if (*iterator.this_arg & IEEE80211_RADIOTAP_F_TX_NOSEQ)
+ info->flags &= ~IEEE80211_TX_CTL_ASSIGN_SEQ;
+ break;
/*
* Please update the file
@@ -1025,6 +1035,8 @@
* it will be cleared/left by radiotap as desired.
*/
tx->flags |= IEEE80211_TX_FRAGMENTED;
+ /* Same here, controlled by radiotap and the stack */
+ info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
/* process and remove the injection radiotap header */
if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) {
@@ -1088,16 +1100,10 @@
return TX_QUEUED;
}
- if (is_multicast_ether_addr(hdr->addr1)) {
- tx->flags &= ~IEEE80211_TX_UNICAST;
+ if (is_multicast_ether_addr(hdr->addr1))
info->flags |= IEEE80211_TX_CTL_NO_ACK;
- } else {
+ else
tx->flags |= IEEE80211_TX_UNICAST;
- if (unlikely(local->wifi_wme_noack_test))
- info->flags |= IEEE80211_TX_CTL_NO_ACK;
- else
- info->flags &= ~IEEE80211_TX_CTL_NO_ACK;
- }
if (tx->flags & IEEE80211_TX_FRAGMENTED) {
if ((tx->flags & IEEE80211_TX_UNICAST) && |
Patch | aircrack-ng/patches/madwifi-ng-r4073.patch | diff -dru madwifi-ng/ath/if_ath.c madwifi-ng-fixed/ath/if_ath.c
--- madwifi-ng/ath/if_ath.c 2009-07-10 01:46:48.000000000 +0200
+++ madwifi-ng-fixed/ath/if_ath.c 2009-07-10 01:59:58.000000000 +0200
@@ -3010,6 +3010,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = netdev_priv(dev);
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = &(SKB_CB(skb)->phy);
const HAL_RATE_TABLE *rt;
@@ -3022,7 +3023,7 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *)skb->data;
- try0 = ph->try[0];
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try[0];
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate[0]);
power = ph->power > 60 ? 60 : ph->power;
@@ -3046,7 +3047,8 @@
rt = sc->sc_currates;
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
- if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+ if (IEEE80211_IS_MULTICAST(wh->i_addr1) || ((ic->ic_opmode ==
+IEEE80211_M_MONITOR) && (skb->data[1]&3) != 0x01) ) {
flags |= HAL_TXDESC_NOACK; /* no ack on broad/multicast */
sc->sc_stats.ast_tx_noack++;
try0 = 1;
Only in madwifi-ng-fixed/ath: if_ath.c.orig
diff -dru madwifi-ng/ath_hal/ar5211/ar5211_reset.c madwifi-ng-fixed/ath_hal/ar5211/ar5211_reset.c
--- madwifi-ng/ath_hal/ar5211/ar5211_reset.c 2009-07-10 01:46:38.000000000 +0200
+++ madwifi-ng-fixed/ath_hal/ar5211/ar5211_reset.c 2009-07-10 01:52:18.000000000 +0200
@@ -987,7 +987,7 @@
if (AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_OAHU &&
ath_hal_getnfcheckrequired(ah, (HAL_CHANNEL *) chan)) {
static const uint8_t runtime[3] = { 0, 2, 7 };
- int16_t nf, nfThresh;
+ int16_t nf, nfThresh = 0;
int i;
if (!getNoiseFloorThresh(ah, chan, &nfThresh))
diff -dru madwifi-ng/ath_hal/ar5212/ar5212_reset.c madwifi-ng-fixed/ath_hal/ar5212/ar5212_reset.c
--- madwifi-ng/ath_hal/ar5212/ar5212_reset.c 2009-07-10 01:46:41.000000000 +0200
+++ madwifi-ng-fixed/ath_hal/ar5212/ar5212_reset.c 2009-07-10 01:53:24.000000000 +0200
@@ -1264,7 +1264,7 @@
{
struct ath_hal_5212 *ahp = AH5212(ah);
struct ar5212NfCalHist *h = &ahp->ah_nfCalHist;
- int16_t nf, nfThresh;
+ int16_t nf, nfThresh = 0;
int32_t val;
if (OS_REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
diff -dru madwifi-ng/net80211/ieee80211_scan_sta.c madwifi-ng-fixed/net80211/ieee80211_scan_sta.c
--- madwifi-ng/net80211/ieee80211_scan_sta.c 2009-07-10 01:46:32.000000000 +0200
+++ madwifi-ng-fixed/net80211/ieee80211_scan_sta.c 2009-07-10 01:56:57.000000000 +0200
@@ -357,7 +357,7 @@
struct ieee80211_scan_state *ss,
enum ieee80211_phymode mode, const u_int16_t freq[], int nfreq)
{
- struct ieee80211_channel *c, *cg;
+ struct ieee80211_channel *c, *cg = NULL;
u_int modeflags;
int i;
@@ -1293,7 +1293,7 @@
u_int32_t flags)
{
struct sta_table *st = ss->ss_priv;
- struct sta_entry *selbs;
+ struct sta_entry *selbs = NULL;
struct ieee80211_channel *chan;
KASSERT(vap->iv_opmode == IEEE80211_M_IBSS ||
diff -dru madwifi-ng/net80211/ieee80211_skb.c madwifi-ng-fixed/net80211/ieee80211_skb.c
--- madwifi-ng/net80211/ieee80211_skb.c 2009-07-10 01:46:32.000000000 +0200
+++ madwifi-ng-fixed/net80211/ieee80211_skb.c 2009-07-10 01:54:54.000000000 +0200
@@ -464,7 +464,7 @@
* - Break the linked list, clearing next skb's prev pointer if possible. */
void ieee80211_dev_kfree_skb(struct sk_buff **pskb)
{
- struct sk_buff *skb;
+ struct sk_buff *skb = NULL;
/* Do not fail on null, as we are going to use this in cleanup code. */
if (!pskb || !(skb = *pskb)) |
Patch | aircrack-ng/patches/madwifi-old-r1417.patch | diff -ur madwifi-old/ath/if_ath.c patched_madwifi-old/ath/if_ath.c
--- madwifi-old/ath/if_ath.c 2006-03-22 21:31:58.814779008 +0100
+++ patched_madwifi-old/ath/if_ath.c 2006-03-22 21:35:10.049706880 +0100
@@ -1436,7 +1436,7 @@
rt = sc->sc_currates;
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
flags = HAL_TXDESC_INTREQ | HAL_TXDESC_CLRDMASK;
- try0 = ATH_TXMAXTRY;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY;
dot11Rate = 0;
ctsrate = 0;
ctsduration = 0;
@@ -1499,6 +1499,13 @@
if (index >= 0 && index < rt->rateCount) {
txrate = rt->info[index].rateCode;
}
+ } else {
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ int index = sc->sc_rixmap[ic->inject_rate / 500];
+ if (index >= 0 && index < rt->rateCount) {
+ txrate = rt->info[index].rateCode;
+ }
+ }
}
wh = (struct ieee80211_frame *) skb->data;
diff -ur madwifi-old/ath/if_ath_pci.c patched_madwifi-old/ath/if_ath_pci.c
--- madwifi-old/ath/if_ath_pci.c 2006-03-22 21:31:58.799781288 +0100
+++ patched_madwifi-old/ath/if_ath_pci.c 2006-03-22 21:36:54.983754480 +0100
@@ -100,12 +100,16 @@
{ 0xa727, 0x0013, PCI_ANY_ID, PCI_ANY_ID }, /* 3com */
{ 0x10b7, 0x0013, PCI_ANY_ID, PCI_ANY_ID }, /* 3com 3CRDAG675 */
{ 0x168c, 0x1014, PCI_ANY_ID, PCI_ANY_ID }, /* IBM minipci 5212 */
+ { 0x168c, 0x101a, PCI_ANY_ID, PCI_ANY_ID }, /* some Griffin-Lite */
{ 0x168c, 0x0015, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0016, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0017, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0018, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0019, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x001a, PCI_ANY_ID, PCI_ANY_ID },
+ { 0x168c, 0x001b, PCI_ANY_ID, PCI_ANY_ID },
+ { 0x168c, 0x001c, PCI_ANY_ID, PCI_ANY_ID }, /* PCI Express 5424 */
+ { 0x168c, 0x001d, PCI_ANY_ID, PCI_ANY_ID }, /* PCI Express ??? */
{ 0 }
};
diff -ur madwifi-old/net80211/ieee80211_crypto.c patched_madwifi-old/net80211/ieee80211_crypto.c
--- madwifi-old/net80211/ieee80211_crypto.c 2006-03-22 21:31:48.848294144 +0100
+++ patched_madwifi-old/net80211/ieee80211_crypto.c 2006-03-22 21:39:22.456335240 +0100
@@ -299,6 +299,11 @@
oflags = key->wk_flags;
flags &= IEEE80211_KEY_COMMON;
+
+ if (cipher == IEEE80211_CIPHER_WEP) {
+ flags |= IEEE80211_KEY_SWCRYPT;
+ }
+
/*
* If the hardware does not support the cipher then
* fallback to a host-based implementation.
diff -ur madwifi-old/net80211/ieee80211_var.h patched_madwifi-old/net80211/ieee80211_var.h
--- madwifi-old/net80211/ieee80211_var.h 2006-03-22 21:31:48.912284416 +0100
+++ patched_madwifi-old/net80211/ieee80211_var.h 2006-03-22 21:40:24.490904552 +0100
@@ -212,6 +212,8 @@
struct net_device *ic_wdsdev[IEEE80211_WDS_MAXNODES];
/* only wds traffic is allowed */
int ic_wdsonly;
+
+ int inject_rate; /* injection rate in Monitor mode */
};
#define IEEE80211_ADDR_EQ(a1,a2) (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
diff -ur madwifi-old/net80211/ieee80211_wireless.c patched_madwifi-old/net80211/ieee80211_wireless.c
--- madwifi-old/net80211/ieee80211_wireless.c 2006-03-22 21:31:48.880289280 +0100
+++ patched_madwifi-old/net80211/ieee80211_wireless.c 2006-03-22 21:47:46.026780896 +0100
@@ -476,6 +476,18 @@
struct ifreq ifr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rate = rrq->value / 1000;
+ if (rate != 1000 && rate != 2000 && rate != 5500 &&
+ rate != 11000 && rate != 6000 && rate != 9000 &&
+ rate != 12000 && rate != 18000 && rate != 24000 &&
+ rate != 36000 && rate != 48000 && rate != 54000 )
+ return -EINVAL;
+ printk(KERN_DEBUG "setting xmit rate to %d\n", rate);
+ ic->inject_rate = rate;
+ return 0;
+ }
+
if (!ic->ic_media.ifm_cur)
return -EINVAL;
memset(&ifr, 0, sizeof(ifr));
@@ -502,6 +514,11 @@
struct ifmediareq imr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rrq->value = ic->inject_rate * 1000;
+ return 0;
+ }
+
memset(&imr, 0, sizeof(imr));
(*ic->ic_media.ifm_status)(ic->ic_dev, &imr);
@@ -942,6 +959,7 @@
#if WIRELESS_EXT >= 15
case IW_MODE_MONITOR:
ifr.ifr_media |= IFM_IEEE80211_MONITOR;
+ ic->inject_rate = 5500; /* default = 5.5M CCK */
break;
#endif
default: |
Patch | aircrack-ng/patches/prism54-svn-20050724.patch | diff -ur ../prism54-svn-20050724/ksrc/islpci_dev.c ./ksrc/islpci_dev.c
--- ../prism54-svn-20050724/ksrc/islpci_dev.c 2005-03-08 16:32:34.000000000 +0100
+++ ./ksrc/islpci_dev.c 2005-07-26 18:56:40.000000000 +0200
@@ -758,9 +758,6 @@
pci_unmap_single(priv->pdev, buf->pci_addr,
MGMT_FRAME_SIZE, PCI_DMA_FROMDEVICE);
buf->pci_addr = 0;
- if (buf->skb)
- dev_kfree_skb(buf->skb);
- buf->skb = NULL;
}
/* clean up data rx buffers */ |
Patch | aircrack-ng/patches/rt2570-k2wrlz-1.6.1_2.6.24.patch | diff -Naur rt2570-k2wrlz-1.6.1/Module/rtusb_main.c rt2570-k2wrlz-1.6.1-24/Module/rtusb_main.c
--- rt2570-k2wrlz-1.6.1/Module/rtusb_main.c 2007-07-05 18:41:51.000000000 +0200
+++ rt2570-k2wrlz-1.6.1-24/Module/rtusb_main.c 2008-06-27 10:48:28.000000000 +0200
@@ -1629,7 +1629,9 @@
netif_stop_queue(netdev);
pAdapter->config = dev->config;
pAdapter->usb = dev;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(pAdapter->net);
+#endif
ether_setup(pAdapter->net);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
SET_ETHTOOL_OPS(net_dev, &rt2x00_ethtool_ops);
@@ -1650,7 +1652,9 @@
pAdapter->net->hard_header_len = 14;
pAdapter->net->mtu = 1500;
pAdapter->net->addr_len = 6;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
pAdapter->net->weight = 64;
+#endif
pAdapter->MediaState = NdisMediaStateDisconnected;
{// find available
@@ -1961,7 +1965,9 @@
netif_stop_queue(netdev);
pAdapter->config = &dev->config->desc;
pAdapter->usb = dev;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(pAdapter->net);
+#endif
ether_setup(pAdapter->net);
netdev->open = usb_rtusb_open;
netdev->stop = usb_rtusb_close;
@@ -1981,7 +1987,9 @@
pAdapter->net->hard_header_len = 14;
pAdapter->net->mtu = 1500;
pAdapter->net->addr_len = 6;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
pAdapter->net->weight = 64;
+#endif
pAdapter->MediaState = NdisMediaStateDisconnected;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
pAdapter->MLMEThr_pid= -1;
@@ -2011,8 +2019,11 @@
for (i = 0; i < 8; i++)
{
sprintf(slot_name, pAdapter->net->name, i);
-
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+ for (device = first_net_device(&init_net); device != NULL;
+#else
for (device = first_net_device(); device != NULL;
+#endif
device = next_net_device(device))
{
if (strncmp(device->name, slot_name, IFNAMSIZ) == 0) |
Patch | aircrack-ng/patches/rt73-k2wrkz-3.0.3_add_EW-7318USg.patch | --- rtmp_def.h 2009-05-12 10:17:36.000000000 +0100
+++ rtmp_def.h.mod 2009-06-15 23:50:39.468750000 +0100
@@ -872,6 +872,8 @@
{USB_DEVICE(0x2019,0xab50)},\
/* Senao */\
{USB_DEVICE(0x1740,0x7100)},\
+ /* EW-7318USg */
+ {USB_DEVICE(0x7392,0x7318)},\
{0}} /* end marker */ |
Patch | aircrack-ng/patches/rt73_2.6.27.patch | diff -Naur rt73-k2wrlz-3.0.1/Module/rtmp_info.c rt73-k2wrlz-3.0.1_rawtx/Module/rtmp_info.c
--- rt73-k2wrlz-3.0.1/Module/rtmp_info.c 2008-07-24 02:05:27.000000000 +0200
+++ rt73-k2wrlz-3.0.1_rawtx/Module/rtmp_info.c 2008-08-12 22:30:20.000000000 +0200
@@ -682,7 +682,11 @@
memcpy(iwe.u.ap_addr.sa_data, &pAdapter->ScanTab.BssEntry[i].Bssid, ETH_ALEN);
previous_ev = current_ev;
+#if WIRELESS_EXT >= 22
+ current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_ADDR_LEN);
+#else
current_ev = iwe_stream_add_event(current_ev,end_buf, &iwe, IW_EV_ADDR_LEN);
+#endif
if (current_ev == previous_ev)
break;
@@ -694,7 +698,11 @@
iwe.u.data.flags = 1;
previous_ev = current_ev;
+#if WIRELESS_EXT >= 22
+ current_ev = iwe_stream_add_point(info, current_ev,end_buf, &iwe, pAdapter->ScanTab.BssEntry[i].Ssid);
+#else
current_ev = iwe_stream_add_point(current_ev,end_buf, &iwe, pAdapter->ScanTab.BssEntry[i].Ssid);
+#endif
if (current_ev == previous_ev)
break;
@@ -717,7 +725,11 @@
iwe.len = IW_EV_UINT_LEN;
previous_ev = current_ev;
+#if WIRELESS_EXT >= 22
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
+#else
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
+#endif
if (current_ev == previous_ev)
break;
@@ -733,7 +745,11 @@
iwe.u.freq.i = 0;
previous_ev = current_ev;
+#if WIRELESS_EXT >= 22
+ current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
+#else
current_ev = iwe_stream_add_event(current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
+#endif
if (current_ev == previous_ev)
break;
@@ -747,7 +763,11 @@
iwe.u.data.flags = IW_ENCODE_DISABLED;
previous_ev = current_ev;
+#if WIRELESS_EXT >= 22
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf,&iwe, (char *)pAdapter->SharedKey[(iwe.u.data.flags & IW_ENCODE_INDEX)-1].Key);
+#else
current_ev = iwe_stream_add_point(current_ev, end_buf,&iwe, (char *)pAdapter->SharedKey[(iwe.u.data.flags & IW_ENCODE_INDEX)-1].Key);
+#endif
if (current_ev == previous_ev)
break;
@@ -762,9 +782,15 @@
{
iwe.u.bitrate.value = RateIdToMbps[pAdapter->ScanTab.BssEntry[i].SupRate[i]/2] * 1000000;
iwe.u.bitrate.disabled = 0;
+#if WIRELESS_EXT >= 22
+ current_val = iwe_stream_add_value(info, current_ev,
+ current_val, end_buf, &iwe,
+ IW_EV_PARAM_LEN);
+#else
current_val = iwe_stream_add_value(current_ev,
current_val, end_buf, &iwe,
IW_EV_PARAM_LEN);
+#endif
}
@@ -817,9 +843,15 @@
}
iwe.u.bitrate.value = max_rate * 500000;
iwe.u.bitrate.disabled = 0;
+#if WIRELESS_EXT >= 22
+ current_val = iwe_stream_add_value(info, current_ev,
+ current_val, end_buf, &iwe,
+ IW_EV_PARAM_LEN);
+#else
current_val = iwe_stream_add_value(current_ev,
current_val, end_buf, &iwe,
IW_EV_PARAM_LEN);
+#endif
if((current_val-current_ev)>IW_EV_LCP_LEN)
current_ev = current_val;
else
@@ -833,7 +865,11 @@
if (iwe.u.data.length)
{
previous_ev = current_ev;
+#if WIRELESS_EXT >= 22
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom);
+#else
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom);
+#endif
if (current_ev == previous_ev)
break;
}
@@ -844,7 +880,11 @@
set_quality(pAdapter, &iwe.u.qual, pAdapter->ScanTab.BssEntry[i].Rssi);
previous_ev = current_ev;
+#if WIRELESS_EXT >= 22
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
+#else
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
+#endif
if (current_ev == previous_ev)
break;
@@ -859,7 +899,11 @@
if (iwe.u.data.length)
{
previous_ev = current_ev;
+#if WIRELESS_EXT >= 22
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, custom);
+#else
current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, custom);
+#endif
if (current_ev == previous_ev)
break;
}
@@ -5703,7 +5747,7 @@
//UCHAR TmpPhy = pAd->PortCfg.PhyMode;
//pAd->PortCfg.PhyMode = 0xff;
//RTMPSetPhyMode(pAd, TmpPhy);
-
+
}
sprintf(msg+strlen(msg), "\n\nChannel | Tx Power\n-------------------\n"); |
Patch | aircrack-ng/patches/rtl8180-0.21v2.patch | diff -Naur rtl8180-0.21_orig/ieee80211_crypt.c rtl8180-0.21_patched/ieee80211_crypt.c
--- rtl8180-0.21_orig/ieee80211_crypt.c 2004-11-27 20:33:23.000000000 +0100
+++ rtl8180-0.21_patched/ieee80211_crypt.c 2007-02-18 17:35:03.000000000 +0100
@@ -11,8 +11,10 @@
*
*/
#ifndef CONFIG_IEEE80211_NOWEP
-#include <linux/config.h>
#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
diff -Naur rtl8180-0.21_orig/ieee80211_crypt_wep.c rtl8180-0.21_patched/ieee80211_crypt_wep.c
--- rtl8180-0.21_orig/ieee80211_crypt_wep.c 2005-04-12 14:25:42.000000000 +0200
+++ rtl8180-0.21_patched/ieee80211_crypt_wep.c 2007-02-18 17:35:03.000000000 +0100
@@ -9,8 +9,10 @@
* more details.
*/
#ifndef CONFIG_IEEE80211_NOWEP
-#include <linux/config.h>
#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
@@ -28,7 +30,11 @@
#endif
#include <linux/crypto.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <asm/scatterlist.h>
+#else
+#include <linux/scatterlist.h>
+#endif
#include <linux/crc32.h>
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,47))
diff -Naur rtl8180-0.21_orig/ieee80211_module.c rtl8180-0.21_patched/ieee80211_module.c
--- rtl8180-0.21_orig/ieee80211_module.c 2005-04-15 00:29:23.000000000 +0200
+++ rtl8180-0.21_patched/ieee80211_module.c 2007-02-18 17:35:03.000000000 +0100
@@ -37,8 +37,11 @@
*******************************************************************************/
#include <linux/init.h>
+#include <linux/version.h>
#include <linux/compiler.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
#include <linux/config.h>
+#endif
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -53,7 +56,6 @@
#include <linux/slab.h>
#include <linux/tcp.h>
#include <linux/types.h>
-#include <linux/version.h>
#include <linux/wireless.h>
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
diff -Naur rtl8180-0.21_orig/ieee80211_rx.c rtl8180-0.21_patched/ieee80211_rx.c
--- rtl8180-0.21_orig/ieee80211_rx.c 2005-04-12 14:13:18.000000000 +0200
+++ rtl8180-0.21_patched/ieee80211_rx.c 2007-02-18 17:35:03.000000000 +0100
@@ -16,8 +16,11 @@
* more details.
*/
+#include <linux/version.h>
#include <linux/compiler.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
#include <linux/config.h>
+#endif
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -32,7 +35,6 @@
#include <linux/slab.h>
#include <linux/tcp.h>
#include <linux/types.h>
-#include <linux/version.h>
#include <linux/wireless.h>
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
diff -Naur rtl8180-0.21_orig/ieee80211_tx.c rtl8180-0.21_patched/ieee80211_tx.c
--- rtl8180-0.21_orig/ieee80211_tx.c 2005-04-12 23:02:17.000000000 +0200
+++ rtl8180-0.21_patched/ieee80211_tx.c 2007-02-18 17:35:03.000000000 +0100
@@ -31,7 +31,10 @@
******************************************************************************/
#include <linux/compiler.h>
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
#include <linux/config.h>
+#endif
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -46,7 +49,6 @@
#include <linux/slab.h>
#include <linux/tcp.h>
#include <linux/types.h>
-#include <linux/version.h>
#include <linux/wireless.h>
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
@@ -577,6 +579,14 @@
spin_lock_irqsave(&ieee->lock,flags);
+ if (ieee->iw_mode == IW_MODE_MONITOR) {
+ ieee->func->hard_data_xmit(ieee->dev,skb,0);
+ dev_kfree_skb_any(skb);
+ ieee->stats.tx_packets++;
+ ieee->dev->trans_start = jiffies;
+ goto exit;
+ }
+
if(ieee->queue_stop){
IEEE80211DMESG("EE: IEEE hard_start_xmit invoked when kernel queue should be stopped");
netif_stop_queue(ieee->dev);
diff -Naur rtl8180-0.21_orig/ieee80211_wx.c rtl8180-0.21_patched/ieee80211_wx.c
--- rtl8180-0.21_orig/ieee80211_wx.c 2005-04-10 19:54:20.000000000 +0200
+++ rtl8180-0.21_patched/ieee80211_wx.c 2007-02-18 17:35:03.000000000 +0100
@@ -34,6 +34,9 @@
******************************************************************************/
#include <linux/wireless.h>
#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
#include <linux/kmod.h> /* request_module */
#include <linux/kernel.h>
diff -Naur rtl8180-0.21_orig/Makefile rtl8180-0.21_patched/Makefile
--- rtl8180-0.21_orig/Makefile 2005-02-27 19:48:47.000000000 +0100
+++ rtl8180-0.21_patched/Makefile 2007-02-18 17:34:21.000000000 +0100
@@ -59,7 +59,7 @@
make -C $(KSRC) SUBDIRS=$(PWD) modules
2.6:
- $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) MODVERDIR=$(PWD) modules
+ $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
clean:
rm -f *.mod.c *.mod *.o .*.cmd *.ko .*.flags
diff -Naur rtl8180-0.21_orig/Makefile26 rtl8180-0.21_patched/Makefile26
--- rtl8180-0.21_orig/Makefile26 2005-02-27 19:48:48.000000000 +0100
+++ rtl8180-0.21_patched/Makefile26 2007-02-18 17:34:21.000000000 +0100
@@ -26,7 +26,7 @@
rm -f *.mod.c *.mod *.o .*.cmd *.ko
rm -rf $(PWD)/tmp
modules:
- $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) MODVERDIR=$(PWD) modules
+ $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless
MOD_ALGDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/alg
diff -Naur rtl8180-0.21_orig/r8180_core.c rtl8180-0.21_patched/r8180_core.c
--- rtl8180-0.21_orig/r8180_core.c 2005-04-12 14:39:56.000000000 +0200
+++ rtl8180-0.21_patched/r8180_core.c 2007-02-18 17:35:03.000000000 +0100
@@ -121,6 +121,7 @@
MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
MODULE_DESCRIPTION("Linux driver for Realtek RTL8180 WiFi cards");
+#if 0
MODULE_PARM(ifname,"s");
MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
@@ -132,7 +133,7 @@
MODULE_PARM(channels,"i");
MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-
+#endif
static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id);
@@ -452,13 +453,14 @@
}
-
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
struct r8180_priv *priv = dev->priv;
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
{
@@ -2204,11 +2206,12 @@
void rtl8180_hard_data_xmit(struct net_device *dev,struct sk_buff *skb,short morefrag)
{
struct r8180_priv *priv = (struct r8180_priv *)dev->priv;
- int mode;
+ int mode, priority = LOW_PRIORITY;
//unsigned long flags;
mode = priv->ieee80211->iw_mode;
-
+ if( mode == IW_MODE_MONITOR )
+ priority = HI_PRIORITY;
/*
* This function doesn't require lock because we make
@@ -2220,13 +2223,13 @@
//spin_lock_irqsave(&priv->tx_lock,flags);
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ if (!check_nic_enought_desc(dev, priority)){
DMESG("Error: no descriptor left by previous TX (avail %d) ",
- get_curr_tx_free_desc(dev, LOW_PRIORITY));
+ get_curr_tx_free_desc(dev, priority));
ieee80211_r8180_stop_queue(priv->ieee80211);
}
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,0);
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, priority, morefrag,0);
+ if (!check_nic_enought_desc(dev, priority))
ieee80211_r8180_stop_queue(priv->ieee80211);
//spin_unlock_irqrestore(&priv->tx_lock,flags);
@@ -2634,7 +2637,11 @@
spin_lock_init(&priv->tx_lock);
sema_init(&priv->wx_sem,1);
priv->workqueue = create_workqueue(DRV_NAME);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->IBSS_work,(void(*)(void*)) rtl8180_IBSS_create_wq,dev);
+#else
+ INIT_WORK(&priv->IBSS_work,(void(*)(void*)) rtl8180_IBSS_create_wq);
+#endif
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long)) rtl8180_irq_rx_tasklet,
@@ -3411,10 +3418,18 @@
if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
rtl8180_IBSS_create(dev);
-/* if (priv->ieee80211->iw_mode == IW_MODE_MONITOR){
+ if (priv->ieee80211->iw_mode == IW_MODE_MONITOR) {
+ priv->retry_rts = 0;
+ priv->retry_data = 0;
+ rtl8180_tx_enable(dev);
+
netif_carrier_on(dev);
+ if(netif_queue_stopped(dev))
+ netif_wake_queue(dev);
+ else
+ netif_start_queue(dev);
}
-*/
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA) {
// rtl8180_tx_enable(dev);
@@ -3608,8 +3623,7 @@
pio_flags = (unsigned long)pci_resource_flags (pdev, 0);
if (!(pio_flags & IORESOURCE_IO)) {
- DMESG("%s: region #0 not a PIO resource, aborting",
- pdev->slot_name);
+ DMESG("r8180: region #0 not a PIO resource, aborting");
goto fail;
}
@@ -3629,8 +3643,7 @@
pmem_flags = pci_resource_flags (pdev, 1);
if (!(pmem_flags & IORESOURCE_MEM)) {
- DMESG("%s: region #1 not a MMIO resource, aborting",
- pdev->slot_name);
+ DMESG("r8180: region #1 not a MMIO resource, aborting");
goto fail;
}
@@ -3664,7 +3677,12 @@
dev->do_ioctl = do_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
if (dev_alloc_name(dev, ifname) < 0){
diff -Naur rtl8180-0.21_orig/r8180.h rtl8180-0.21_patched/r8180.h
--- rtl8180-0.21_orig/r8180.h 2005-04-11 18:36:26.000000000 +0200
+++ rtl8180-0.21_patched/r8180.h 2007-02-18 17:35:09.000000000 +0100
@@ -25,7 +25,10 @@
#include <linux/module.h>
#include <linux/kernel.h>
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
#include <linux/config.h>
+#endif
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h> |
Patch | aircrack-ng/patches/rtl8187-mac80211-injection-speed-2.6.28-rc6.patch | diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 9212cea..08d04a3 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -214,7 +214,11 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
hdr->flags = cpu_to_le32(flags);
hdr->len = 0;
hdr->rts_duration = rts_dur;
- hdr->retry = cpu_to_le32(info->control.retry_limit << 8);
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ hdr->retry =
+ cpu_to_le32(info->control.retry_limit << 8);
+ else
+ hdr->retry = 0;
buf = hdr;
ep = 2;
@@ -232,7 +235,11 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
memset(hdr, 0, sizeof(*hdr));
hdr->flags = cpu_to_le32(flags);
hdr->rts_duration = rts_dur;
- hdr->retry = cpu_to_le32(info->control.retry_limit << 8);
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ hdr->retry =
+ cpu_to_le32(info->control.retry_limit << 8);
+ else
+ hdr->retry = 0;
hdr->tx_duration =
ieee80211_generic_frame_duration(dev, priv->vif,
skb->len, txrate); |
Patch | aircrack-ng/patches/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch | diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 9212cea..08d04a3 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -258,7 +258,11 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
hdr->flags = cpu_to_le32(flags);
hdr->len = 0;
hdr->rts_duration = rts_dur;
- hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ hdr->retry =
+ cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ else
+ hdr->retry = 0;
buf = hdr;
ep = 2;
@@ -276,7 +280,11 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
memset(hdr, 0, sizeof(*hdr));
hdr->flags = cpu_to_le32(flags);
hdr->rts_duration = rts_dur;
- hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ hdr->retry =
+ cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ else
+ hdr->retry = 0;
hdr->tx_duration =
ieee80211_generic_frame_duration(dev, priv->vif,
skb->len, txrate); |
Patch | aircrack-ng/patches/rtl8187-ng-2.6.31.patch | diff -ur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006.netdev/beta-8187/r8187_core.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2009-11-02 17:37:33.944878408 +0100
+++ rtl8187_linux_26.1010.0622.2006.netdev/beta-8187/r8187_core.c 2009-11-02 17:50:23.252287868 +0100
@@ -1892,8 +1892,10 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
- dev->get_stats = rtl8180_stats;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
+ dev->get_stats = rtl8180_stats;
+#endif
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
@@ -2596,7 +2598,19 @@
/****************************************************************************
---------------------------- USB_STUFF---------------------------
*****************************************************************************/
-
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+static const struct net_device_ops rtl8180_netdev_ops = {
+ .ndo_open = rtl8180_open,
+ .ndo_stop = rtl8180_close,
+ .ndo_get_stats = rtl8180_stats,
+ .ndo_tx_timeout = tx_timeout,
+ .ndo_do_ioctl = rtl8180_ioctl,
+ .ndo_set_multicast_list = r8180_set_multicast,
+ .ndo_set_mac_address = r8180_set_mac_adr,
+ //.ndo_start_xmit = rtl8180_8023_hard_start_xmit,
+};
+#endif
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
@@ -2620,16 +2634,20 @@
priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
- priv->udev=udev;
-
- dev->open = rtl8180_open;
- dev->stop = rtl8180_close;
- //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
- dev->tx_timeout = tx_timeout;
- dev->wireless_handlers = &r8180_wx_handlers_def;
- dev->do_ioctl = rtl8180_ioctl;
- dev->set_multicast_list = r8180_set_multicast;
- dev->set_mac_address = r8180_set_mac_adr;
+ priv->udev=udev;
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ dev->netdev_ops = &rtl8180_netdev_ops;
+#else
+ dev->open = rtl8180_open;
+ dev->stop = rtl8180_close;
+ //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
+ dev->tx_timeout = tx_timeout;
+ dev->wireless_handlers = &r8180_wx_handlers_def;
+ dev->do_ioctl = rtl8180_ioctl;
+ dev->set_multicast_list = r8180_set_multicast;
+ dev->set_mac_address = r8180_set_mac_adr;
+#endif
#if WIRELESS_EXT >= 12
#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
diff -ur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006.netdev/ieee80211/ieee80211_module.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2009-11-02 17:37:33.954872206 +0100
+++ rtl8187_linux_26.1010.0622.2006.netdev/ieee80211/ieee80211_module.c 2009-11-02 17:39:50.322350883 +0100
@@ -103,6 +103,11 @@
list_add_tail(&ieee->networks[i].list, &ieee->network_free_list);
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+static struct net_device_ops ieee80211_netdev_ops = {
+ .ndo_start_xmit = ieee80211_xmit_rtl7,
+};
+#endif
struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
@@ -118,7 +123,11 @@
goto failed;
}
ieee = netdev_priv(dev);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ dev->netdev_ops = &ieee80211_netdev_ops;
+#else
dev->hard_start_xmit = ieee80211_xmit_rtl7;
+#endif
ieee->dev = dev; |
Patch | aircrack-ng/patches/rtl8187_2.6.27.patch | diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/ieee80211_crypt.h 2006-06-05 22:58:02.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h 2008-08-12 13:11:32.000000000 -0400
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/ieee80211.h 2006-06-05 22:58:02.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h 2008-08-12 14:23:31.000000000 -0400
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,21 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-
-extern inline void *ieee80211_priv(struct net_device *dev)
+#if WIRELESS_EXT >= 22
+static inline void *ieee80211_priv_rtl7(struct net_device *dev)
+#else
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
+#endif
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1200,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1226,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1254,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1401,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1419,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/Makefile 2006-06-05 22:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile 2008-08-12 13:11:32.000000000 -0400
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_93cx6.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_93cx6.c 2006-06-05 22:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c 2008-08-12 13:11:32.000000000 -0400
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_hw.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_hw.h 2006-06-05 22:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h 2008-08-12 13:11:32.000000000 -0400
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_rtl8225.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_rtl8225.c 2006-06-05 22:58:02.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c 2008-08-12 13:11:32.000000000 -0400
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_rtl8225.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_rtl8225.h 2006-06-05 22:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h 2008-08-12 13:11:32.000000000 -0400
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_rtl8225z2.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_rtl8225z2.c 2006-06-05 22:58:02.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c 2008-08-12 13:11:32.000000000 -0400
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 1
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,48 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
- max_cck_power_level = 15;
+
+
+ max_cck_power_level = 35;
//min_cck_power_level = 0;
- max_ofdm_power_level = 25; // 12 -> 25
+ max_ofdm_power_level = 35; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+ if(cck_power_level >= 20 && cck_power_level < 30)
+ cck_power_level = 19;
+
for(i=0;i<8;i++){
-
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +482,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +511,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +557,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +626,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +681,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +711,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +741,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +772,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +799,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +824,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +852,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +902,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +915,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x86); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +980,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1007,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1024,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8180_wx.c 2006-06-05 22:58:02.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c 2008-08-12 13:11:32.000000000 -0400
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,228 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(!(priv->highpower) && wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > 35)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+// if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+// if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
+ up(&priv->wx_sem);
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_highpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ int i=0;
+ short prev = priv->highpower;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->highpower=1;
+ else
+ priv->highpower=0;
+
+ DMESG("Increasable transmission power %s",
+ priv->highpower ? "enabled" : "disabled");
+
+ if( (prev != priv->highpower) && !(priv->highpower) && (priv->chtxpwr[1] > priv->chtxpwr_orig[1]) )
+ {
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i];
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i];
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+ wrqu->power.value = priv->txpwr_max;
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +307,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +340,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +364,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +388,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +407,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +459,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +490,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +498,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +518,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +568,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +606,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +624,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +654,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +692,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +744,55 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "highpower"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
+ },
+
+ {
+ SIOCIWFIRSTPRIV + 0x3,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_highpower, /*SIOCIWSECONDPRIV*/
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +805,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8187_core.c 2006-06-22 01:43:30.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c 2008-08-12 13:11:32.000000000 -0400
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,35 +414,44 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
+#else
+ rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net);
+#endif
}
void rtl8180_proc_module_remove(void)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
+#else
+ remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net);
+#endif
}
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +468,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +480,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +489,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +508,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +544,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +560,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +582,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +604,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +623,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +637,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +659,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +779,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +823,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +848,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +886,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +913,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +930,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +955,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +967,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +980,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +996,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +1006,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1022,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1046,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1078,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1129,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1142,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1156,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1177,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1209,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1224,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1239,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1248,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1256,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1304,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1323,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1381,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1392,20 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1417,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1430,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1443,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1485,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1502,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1601,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1612,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1633,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1660,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1687,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1728,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1775,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1835,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1883,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1892,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1975,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2010,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2039,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2059,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2083,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2129,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2195,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2218,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2232,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2276,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2415,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2433,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2453,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2464,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2477,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2587,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2606,22 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+#endif
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2630,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2678,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2695,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2712,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2725,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2740,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8187_core.c~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8187_core.c~ 2006-06-22 01:40:10.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~ 1969-12-31 19:00:00.000000000 -0500
@@ -1,2527 +0,0 @@
-/*
- This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
- Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
- from Patric Schenke & Andres Salomon.
-
- Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
- some ideas might be derived from David Young rtl8180 netbsd driver.
-
- Parts of the usb code are from the r8150.c driver in linux kernel
-
- Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
- Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
-
- - Please note that this file is a modified version from rtl8180-sa2400
- drv. So some other people have contributed to this project, and they are
- thanked in the rtl8180-sa2400 CHANGELOG.
-*/
-
-#ifndef CONFIG_FORCE_HARD_FLOAT
-double __floatsidf (int i) { return i; }
-unsigned int __fixunsdfsi (double d) { return d; }
-double __adddf3(double a, double b) { return a+b; }
-double __addsf3(float a, float b) { return a+b; }
-double __subdf3(double a, double b) { return a-b; }
-double __extendsfdf2(float a) {return a;}
-#endif
-
-#undef LOOP_TEST
-#undef DUMP_RX
-#undef DUMP_TX
-#undef DEBUG_TX_DESC2
-#undef RX_DONT_PASS_UL
-#undef DEBUG_EPROM
-#undef DEBUG_RX_VERBOSE
-#undef DUMMY_RX
-#undef DEBUG_ZERO_RX
-#undef DEBUG_RX_SKB
-#undef DEBUG_TX_FRAG
-#undef DEBUG_RX_FRAG
-#undef DEBUG_TX_FILLDESC
-#undef DEBUG_TX
-#undef DEBUG_IRQ
-#undef DEBUG_RX
-#undef DEBUG_RXALLOC
-#undef DEBUG_REGISTERS
-#undef DEBUG_RING
-#undef DEBUG_IRQ_TASKLET
-#undef DEBUG_TX_ALLOC
-#undef DEBUG_TX_DESC
-
-//#define CONFIG_RTL8180_IO_MAP
-
-#include "r8180_hw.h"
-#include "r8187.h"
-#include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
-#include "r8180_93cx6.h" /* Card EEPROM */
-#include "r8180_wx.h"
-
-
-// FIXME: check if 2.6.7 is ok
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
-#define usb_kill_urb usb_unlink_urb
-#endif
-
-#ifdef CONFIG_RTL8180_PM
-#include "r8180_pm.h"
-#endif
-
-#ifndef USB_VENDOR_ID_REALTEK
-#define USB_VENDOR_ID_REALTEK 0x0bda
-#endif
-#ifndef USB_VENDOR_ID_NETGEAR
-#define USB_VENDOR_ID_NETGEAR 0x0846
-#endif
-
-static struct usb_device_id rtl8187_usb_id_tbl[] = {
- {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)},
- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)},
- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6a00)},
-
- {}
-};
-
-static char* ifname = "wlan%d";
-#if 0
-static int hwseqnum = 0;
-static int hwwep = 0;
-#endif
-static int channels = 0x3fff;
-
-MODULE_LICENSE("GPL");
-MODULE_VERSION("V 1.1");
-MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
-MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
-MODULE_DESCRIPTION("Linux driver for Realtek RTL8187 WiFi cards");
-
-#if 0
-MODULE_PARM(ifname,"s");
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-
-MODULE_PARM(hwseqnum,"i");
-MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-
-MODULE_PARM(hwwep,"i");
-MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-
-MODULE_PARM(channels,"i");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
-module_param(ifname, charp, S_IRUGO|S_IWUSR );
-//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
-//module_param(hwwep,int, S_IRUGO|S_IWUSR);
-module_param(channels,int, S_IRUGO|S_IWUSR);
-#else
-MODULE_PARM(ifname, "s");
-//MODULE_PARM(hwseqnum,"i");
-//MODULE_PARM(hwwep,"i");
-MODULE_PARM(channels,"i");
-#endif
-
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-//MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-
-static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id);
-
-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
-
-static struct usb_driver rtl8187_usb_driver = {
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
- .owner = THIS_MODULE,
-#endif
- .name = RTL8187_MODULE_NAME, /* Driver name */
- .id_table = rtl8187_usb_id_tbl, /* PCI_ID table */
- .probe = rtl8187_usb_probe, /* probe fn */
- .disconnect = rtl8187_usb_disconnect, /* remove fn */
-#ifdef CONFIG_RTL8180_PM
- .suspend = rtl8180_suspend, /* PM suspend fn */
- .resume = rtl8180_resume, /* PM resume fn */
-#else
- .suspend = NULL, /* PM suspend fn */
- .resume = NULL, /* PM resume fn */
-#endif
-};
-
-
-void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xfe00, 0, &data, 1, HZ / 2);
-}
-
-
-void write_nic_byte(struct net_device *dev, int indx, u8 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 1, HZ / 2);
-}
-
-
-void write_nic_word(struct net_device *dev, int indx, u16 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 2, HZ / 2);
-}
-
-
-void write_nic_dword(struct net_device *dev, int indx, u32 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 4, HZ / 2);
-}
-
-
-
-u8 read_nic_byte(struct net_device *dev, int indx)
-{
- u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 1, HZ / 2);
- return data;
-}
-
-u8 read_nic_byte_E(struct net_device *dev, int indx)
-{
- u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xfe00, 0, &data, 1, HZ / 2);
- return data;
-}
-
-
-u16 read_nic_word(struct net_device *dev, int indx)
-{
- u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 2, HZ / 2);
- return data;
-}
-
-
-u32 read_nic_dword(struct net_device *dev, int indx)
-{
- u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 4, HZ / 2);
- return data;
-}
-
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
- * plans are to possibilty turn it again in one common code...
- */
-inline void force_pci_posting(struct net_device *dev)
-{
-}
-
-
-//irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs);
-//void set_nic_rxring(struct net_device *dev);
-//void set_nic_txring(struct net_device *dev);
-static struct net_device_stats *rtl8180_stats(struct net_device *dev);
-void rtl8180_commit(struct net_device *dev);
-void rtl8180_restart(struct net_device *dev);
-
-/****************************************************************************
- -----------------------------PROCFS STUFF-------------------------
-*****************************************************************************/
-
-static struct proc_dir_entry *rtl8180_proc = NULL;
-
-static int proc_get_registers(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
- int i,n;
-
- int max=0xff;
-
- /* This dump the current register page */
- for(n=0;n<=max;)
- {
- //printk( "\nD: %2x> ", n);
- len += snprintf(page + len, count - len,
- "\nD: %2x > ",n);
-
- for(i=0;i<16 && n<=max;i++,n++)
- len += snprintf(page + len, count - len,
- "%2x ",read_nic_byte(dev,n));
-
- // printk("%2x ",read_nic_byte(dev,n));
- }
- len += snprintf(page + len, count - len,"\n");
-
-
-
- *eof = 1;
- return len;
-
-}
-
-#if 0
-static int proc_get_stats_hw(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "NIC int: %lu\n"
- "Total int: %lu\n",
- priv->stats.ints,
- priv->stats.shints);
-
- *eof = 1;
- return len;
-}
-#endif
-
-static int proc_get_stats_tx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "TX normal priority ok int: %lu\n"
- "TX normal priority error int: %lu\n"
-// "TX high priority ok int: %lu\n"
-// "TX high priority failed error int: %lu\n"
- "TX low priority ok int: %lu\n"
- "TX low priority failed error int: %lu\n"
- "TX queue resume: %lu\n"
- "TX queue stopped?: %d\n"
- "TX fifo overflow: %lu\n"
-// "TX beacon: %lu\n"
- "TX lp queue: %d\n"
- "TX np queue: %d\n"
- "TX HW queue: %d\n"
- "TX lp dropped: %lu\n"
- "TX np dropped: %lu\n"
- "TX total data packets %lu\n",
-// "TX beacon aborted: %lu\n",
- priv->stats.txnpokint,
- priv->stats.txnperr,
-// priv->stats.txhpokint,
-// priv->stats.txhperr,
- priv->stats.txlpokint,
- priv->stats.txlperr,
- priv->stats.txresumed,
- netif_queue_stopped(dev),
- priv->stats.txoverflow,
-// priv->stats.txbeacon,
- atomic_read(&(priv->tx_lp_pending)),
- atomic_read(&(priv->tx_np_pending)),
- read_nic_byte(dev, TXFIFOCOUNT),
- priv->stats.txlpdrop,
- priv->stats.txnpdrop,
- priv->stats.txdatapkt
-// priv->stats.txbeaconerr
- );
-
- *eof = 1;
- return len;
-}
-
-
-
-static int proc_get_stats_rx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "RX packets: %lu\n"
- "RX urb status error: %lu\n"
- "RX invalid urb error: %lu\n",
- priv->stats.rxok,
- priv->stats.rxstaterr,
- priv->stats.rxurberr);
-
- *eof = 1;
- return len;
-}
-
-
-static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return &priv->wstats;
-}
-
-void rtl8180_proc_module_init(void)
-{
- DMESG("Initializing proc filesystem");
- rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
-}
-
-
-void rtl8180_proc_module_remove(void)
-{
- remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
-}
-
-
-void rtl8180_proc_remove_one(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- if (priv->dir_dev) {
- // remove_proc_entry("stats-hw", priv->dir_dev);
- remove_proc_entry("stats-tx", priv->dir_dev);
- remove_proc_entry("stats-rx", priv->dir_dev);
- // remove_proc_entry("stats-ieee", priv->dir_dev);
- // remove_proc_entry("stats-ap", priv->dir_dev);
- remove_proc_entry("registers", priv->dir_dev);
- remove_proc_entry(dev->name, rtl8180_proc);
- priv->dir_dev = NULL;
- }
-}
-
-
-void rtl8180_proc_init_one(struct net_device *dev)
-{
- struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
- rtl8180_proc);
- if (!priv->dir_dev) {
- DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
- dev->name);
- return;
- }
- #if 0
- e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_hw, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-hw\n",
- dev->name);
- }
- #endif
- e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_rx, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-rx\n",
- dev->name);
- }
-
-
- e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_tx, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-tx\n",
- dev->name);
- }
- #if 0
- e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ieee, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-ieee\n",
- dev->name);
- }
-
-
- e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ap, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-ap\n",
- dev->name);
- }
- #endif
-
- e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_registers, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/registers\n",
- dev->name);
- }
-}
-/****************************************************************************
- -----------------------------MISC STUFF-------------------------
-*****************************************************************************/
-
-/* this is only for debugging */
-void print_buffer(u32 *buffer, int len)
-{
- int i;
- u8 *buf =(u8*)buffer;
-
- printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
- for(i=0;i<len;i++)
- printk("%c",buf[i]);
-
- printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
- for(i=0;i<len;i++)
- printk("%x",buf[i]);
-
- printk("\n");
-}
-
-short check_nic_enought_desc(struct net_device *dev, priority_t priority)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
- &priv->tx_np_pending : &priv->tx_lp_pending);
-
- return (used < MAX_TX_URB);
-}
-
-void tx_timeout(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- //rtl8180_commit(dev);
- schedule_work(&priv->reset_wq);
- //DMESG("TXTIMEOUT");
-}
-
-
-/* this is only for debug */
-void dump_eprom(struct net_device *dev)
-{
- int i;
- for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
-}
-
-/* this is only for debug */
-void rtl8180_dump_reg(struct net_device *dev)
-{
- int i;
- int n;
- int max=0xff;
-
- DMESG("Dumping NIC register map");
-
- for(n=0;n<=max;)
- {
- printk( "\nD: %2x> ", n);
- for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
- }
- printk("\n");
-}
-
-/****************************************************************************
- ------------------------------HW STUFF---------------------------
-*****************************************************************************/
-
-
-void rtl8180_irq_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- //priv->irq_enabled = 1;
-/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
- INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
- INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
-*/
- write_nic_word(dev,INTA_MASK, priv->irq_mask);
-}
-
-
-void rtl8180_irq_disable(struct net_device *dev)
-{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- write_nic_word(dev,INTA_MASK,0);
- force_pci_posting(dev);
-// priv->irq_enabled = 0;
-}
-
-
-void rtl8180_set_mode(struct net_device *dev,int mode)
-{
- u8 ecmd;
- ecmd=read_nic_byte(dev, EPROM_CMD);
- ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK;
- ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT);
- ecmd=ecmd &~ (1<<EPROM_CS_SHIFT);
- ecmd=ecmd &~ (1<<EPROM_CK_SHIFT);
- write_nic_byte(dev, EPROM_CMD, ecmd);
-}
-
-
-void rtl8180_update_msr(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- u8 msr;
-
- msr = read_nic_byte(dev, MSR);
- msr &= ~ MSR_LINK_MASK;
-
- /* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
- * this is intentional and make sense for ad-hoc and
- * master (see the create BSS/IBSS func)
- */
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
- if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
- msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
- else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
- msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
- else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
- msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
- }else
- msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
- write_nic_byte(dev, MSR, msr);
-}
-
-void rtl8180_set_chan(struct net_device *dev,short ch)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u32 tx;
- priv->chan=ch;
- #if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
- priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
- priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
- }
- #endif
-
- /* this hack should avoid frame TX during channel setting*/
- tx = read_nic_dword(dev,TX_CONF);
- tx &= ~TX_LOOPBACK_MASK;
-
-#ifndef LOOP_TEST
- write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
- priv->rf_set_chan(dev,priv->chan);
- mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
-#endif
-}
-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
-
-
-void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- int err;
-
-// u8 *rx;
-
- //DMESG("starting RX");
- /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
- DMESGE("unable to allocate RX buffer");
- return;
- }*/
-
- usb_fill_bulk_urb(rx_urb,priv->udev,
- usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
- RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
- if(err && err != -EPERM){
- DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
- }
-
-}
-
-
-void rtl8187_rx_initiate(struct net_device *dev)
-{
- int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- if(!priv->rx_urb)
- DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
- rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
-}
-
-void rtl8187_set_rxconf(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u32 rxconf;
-
- rxconf=read_nic_dword(dev,RX_CONF);
- rxconf = rxconf &~ MAC_FILTER_MASK;
- rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
-
- if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
- dev->flags & IFF_PROMISC){
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- }else{
- rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
- }
-
- /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
- }*/
-
- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
- rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
- }
-
- if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
- rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
- rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
- rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
- rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
- rxconf = rxconf &~ MAX_RX_DMA_MASK;
- rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
- rxconf = rxconf | RCR_ONLYERLPKT;
-
-// rxconf = rxconf &~ RCR_CS_MASK;
-// rxconf = rxconf | (1<<RCR_CS_SHIFT);
-
- write_nic_dword(dev, RX_CONF, rxconf);
-
- // V rtl suggested V //
-// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
- //fix_rx_fifo(dev);
-// //set_nic_rxring(dev);
- #ifdef DEBUG_RX
- DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF));
- #endif
-}
-
-void rtl8180_rx_enable(struct net_device *dev)
-{
- u8 cmd;
-
-
- rtl8187_rx_initiate(dev);
-
- rtl8187_set_rxconf(dev);
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
-#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
- */
- //mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
-#endif
-
-}
-
-
-void rtl8180_tx_enable(struct net_device *dev)
-{
- u8 cmd;
- u8 byte;
- u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- byte = read_nic_byte(dev,CW_CONF);
- byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
- byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
- write_nic_byte(dev, CW_CONF, byte);
-
- byte = read_nic_byte(dev, TX_AGC_CTL);
- byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
- byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
- byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
- write_nic_byte(dev, TX_AGC_CTL, byte);
-
- txconf= read_nic_dword(dev,TX_CONF);
-
- #if 0
- if(priv->card_8185){
-
- txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
- }else{
-
- if(priv->ieee80211->hw_seq)
- txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
- txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- }
- #endif
-
- txconf = txconf &~ TX_LOOPBACK_MASK;
-
-#ifndef LOOP_TEST
- txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
-#else
- txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
-#endif
- txconf = txconf &~ TCR_DPRETRY_MASK;
- txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
- txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
- txconf = txconf &~ TCR_MXDMA_MASK;
- txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
- txconf = txconf | TCR_CWMIN;
- txconf = txconf | TCR_DISCW;
- txconf = txconf &~ TCR_SWPLCPLEN;
-
- txconf=txconf | (1<<TX_NOICV_SHIFT);
-
- write_nic_dword(dev,TX_CONF,txconf);
-
- // V RTL suggested V //
-// write_nic_dword(dev,TX_CONF,0x00e00707);
-
-
-#ifdef DEBUG_TX
- DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
-#endif
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
-
-// mdelay(100);
- //write_nic_dword(dev,TX_CONF,txconf);
-// #endif
-/*
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev, TX_DMA_POLLING, priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- */
-}
-
-#if 0
-void rtl8180_beacon_tx_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-
-
-void rtl8180_
-_disable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-
-#endif
-
-
-void rtl8180_rtx_disable(struct net_device *dev)
-{
- u8 cmd;
- int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev, CMD, cmd &~ \
- ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
- force_pci_posting(dev);
- mdelay(10);
- if(priv->rx_urb){
- for(i=0;i<MAX_RX_URB;i++)
- usb_kill_urb(priv->rx_urb[i]);
- }
- /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
- */
-
-// if(!priv->rx_skb_complete)
-// dev_kfree_skb_any(priv->rx_skb);
-}
-
-
-int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
-{
- #if 0
- int i;
- u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
- &priv->txbeaconringdma);
- if (!priv->txbeaconring) return -1;
- for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
- /*
- *(tmp+2) = (u32)dma_tmp;
- *(tmp+3) = bufsize;
- */
- if(i+1<count)
- *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
- else
- *(tmp+4) = (u32)priv->txbeaconringdma;
-
- tmp=tmp+8;
- }
- #endif
- return 0;
-}
-
-
-void rtl8180_reset(struct net_device *dev)
-{
-
- u8 cr;
-
- /* make sure the analog power is on before
- * reset, otherwise reset may fail
- */
- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
- rtl8180_irq_disable(dev);
-
- mdelay(200);
- write_nic_byte_E(dev,0x18,0x10);
- write_nic_byte_E(dev,0x18,0x11);
- write_nic_byte_E(dev,0x18,0x00);
- mdelay(200);
-
- cr=read_nic_byte(dev,CMD);
- cr = cr & 2;
- cr = cr | (1<<CMD_RST_SHIFT);
- write_nic_byte(dev,CMD,cr);
-
- force_pci_posting(dev);
-
- mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
- DMESGW("Card reset timeout!");
- else
- DMESG("Card successfully reset");
-
- rtl8180_set_mode(dev,EPROM_CMD_LOAD);
- force_pci_posting(dev);
- mdelay(200);
-
- /* after the eeprom load cycle, make sure we have
- * correct anaparams
- */
- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
-}
-
-inline u16 ieeerate2rtlrate(int rate)
-{
- switch(rate){
- case 10:
- return 0;
- case 20:
- return 1;
- case 55:
- return 2;
- case 110:
- return 3;
- case 60:
- return 4;
- case 90:
- return 5;
- case 120:
- return 6;
- case 180:
- return 7;
- case 240:
- return 8;
- case 360:
- return 9;
- case 480:
- return 10;
- case 540:
- return 11;
- default:
- return 3;
-
- }
-}
-static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
-inline u16 rtl8180_rate2rate(short rate)
-{
- if (rate >11) return 0;
- return rtl_rate[rate];
-}
-
-
-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- priv->rxurb_task = rx_urb;
-// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
-// DMESGW("=David: Rx tasklet finish!");
-}
-
-#if 0
-void rtl8180_tx_queues_stop(struct net_device *dev)
-{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
-
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-#endif
-
-void rtl8180_data_hard_stop(struct net_device *dev)
-{
- //FIXME !!
- #if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- #endif
-}
-
-
-void rtl8180_data_hard_resume(struct net_device *dev)
-{
- // FIXME !!
- #if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- #endif
-}
-
-
-/* this function TX data frames when the ieee80211 stack requires this.
- * It checks also if we need to stop the ieee tx queue, eventually do it
- */
-void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
- unsigned long flags;
- struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
-
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
-// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
- /*
- * This function doesn't require lock because we make
- * sure it's called with the tx_lock already acquired.
- * this come from the kernel's hard_xmit callback (trought
- * the ieee stack, or from the try_wake_queue (again trought
- * the ieee stack.
- */
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
-}
-#if 0
-/* This is a rough attempt to TX a frame
- * This is called by the ieee 80211 stack to TX management frames.
- * If the ring is full packet are dropped (for data frame the queue
- * is stopped before this can happen).
- */
-int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- int ret;
- unsigned long flags;
-
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
-/*
- int i;
- for(i=0;i<skb->len;i++)
- printk("%x ", skb->data[i]);
- printk("--------------------\n");
-*/
- priv->ieee80211->stats.tx_bytes+=skb->len;
- priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
- dev_kfree_skb_any(skb);
- return ret;
-}
-#endif
-
-#if 0
-// longpre 144+48 shortpre 72+24
-u16 rtl8180_len2duration(u32 len, short rate,short* ext)
-{
- u16 duration;
- u16 drift;
- *ext=0;
-
- switch(rate){
- case 0://1mbps
- *ext=0;
- duration = ((len+4)<<4) /0x2;
- drift = ((len+4)<<4) % 0x2;
- if(drift ==0 ) break;
- duration++;
- break;
-
- case 1://2mbps
- *ext=0;
- duration = ((len+4)<<4) /0x4;
- drift = ((len+4)<<4) % 0x4;
- if(drift ==0 ) break;
- duration++;
- break;
-
- case 2: //5.5mbps
- *ext=0;
- duration = ((len+4)<<4) /0xb;
- drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
- break;
- duration++;
- break;
-
- default:
- case 3://11mbps
- *ext=0;
- duration = ((len+4)<<4) /0x16;
- drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
- break;
- duration++;
- if(drift > 6)
- break;
- *ext=1;
- break;
- }
-
- return duration;
-}
-#endif
-
-void rtl8180_try_wake_queue(struct net_device *dev, int pri);
-
-void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(tx_urb->status == 0)
- priv->stats.txlpokint++;
- else
- priv->stats.txlperr++;
- kfree(tx_urb->transfer_buffer);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_lp_pending);
- rtl8180_try_wake_queue(dev,LOW_PRIORITY);
-}
-
-
-void rtl8187_beacon_stop(struct net_device *dev)
-{
- u8 msr, msrm, msr2;
- msr = read_nic_byte(dev, MSR);
- msrm = msr & MSR_LINK_MASK;
- msr2 = msr & ~MSR_LINK_MASK;
- if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
- (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
- write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
- }
-
-
-}
-
-
-void rtl8187_net_update(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct ieee80211_network *net;
- net = & priv->ieee80211->current_network;
-
-
- write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
- write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
- //for(i=0;i<ETH_ALEN;i++)
- // write_nic_byte(dev,BSSID+i,net->bssid[i]);
-
- rtl8180_update_msr(dev);
-
-// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
- write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
- write_nic_word(dev, BcnIntTime, 100);
-
-
-}
-
-void rtl8187_beacon_tx(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct sk_buff *skb;
- int i = 0;
-
- rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
- DMESG("not enought memory for allocating beacon");
- return;
- }
-
-#if 0
- while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
- msleep_interruptible_rtl(HZ/2);
- if(i++ > 20){
- DMESG("get stuck to wait EP3 become ready");
- return ;
- }
- }
-#endif
- write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
- i=0;
- //while(!read_nic_byte(dev,BQREQ & (1<<7)))
- while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
- {
- msleep_interruptible_rtl(HZ/2);
- if(i++ > 10){
- DMESG("get stuck to wait HW beacon to be ready");
- return ;
- }
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
- 0, priv->ieee80211->basic_rate);
-
-}
-
-void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(tx_urb->status == 0)
- priv->stats.txnpokint++;
- else
- priv->stats.txnperr++;
- kfree(tx_urb->transfer_buffer);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_np_pending);
- //rtl8180_try_wake_queue(dev,NORM_PRIORITY);
-}
-
-
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
- */
-
-short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
- short morefrag, short rate)
-{
- u32 *tx;
-// u16 duration;
-// short ext;
- int pend ;
- int status;
- struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
-// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
-
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
- if( pend > MAX_TX_URB){
- if(priority == NORM_PRIORITY)
- priv->stats.txnpdrop++;
- else
- priv->stats.txlpdrop++;
- return -1;
- }
-
-
- //tx = kmalloc((len + 4*3), GFP_ATOMIC);
- urb_len = len + 4*3;
- if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
- }
- tx = kmalloc(urb_len, GFP_ATOMIC);
- if(!tx) return -ENOMEM;
-printk(KERN_WARNING "urb_len = %d\n", urb_len);
- tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
- if(!tx_urb){
-
- kfree(tx);
- return -ENOMEM;
- }
-
- memcpy(tx+3,txbuf,len);
- tx[0] = 0;
- tx[0] |= len & 0xfff;
- tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
- if(morefrag) tx[0] |= (1<<17);
- tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
- tx[0] |= (rate << 24);
- tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
-
-// tx[2] = 0x303020;
- tx[2] = 3; // CW min
- tx[2] |= (7<<4); //CW max
- tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
-// printk("%x\n%x\n",tx[0],tx[1]);
-
- #ifdef DUMP_TX
- int i;
- printk("<Tx pkt>--rate %x---",rate);
- for (i = 0; i < (len + 3); i++)
- printk("%2x", ((u8*)tx)[i]);
- printk("---------------\n");
- #endif
-
-
- /* FIXME check what EP is for low/norm PRI */
- usb_fill_bulk_urb(tx_urb,priv->udev,
- usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
- urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev);
- status = usb_submit_urb(tx_urb, GFP_ATOMIC);
- if (!status){
- atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- return 0;
- }else{
- DMESGE("Error TX URB %d, error %d",
- atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
- status);
- return -1;
- }
-}
-
-
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
-
-
-short rtl8187_usb_initendpoints(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i;
-
- priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
- for(i=0;i<MAX_RX_URB;i++){
- priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
- goto destroy;
-
- priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
- goto destroy1;
-
- priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
- }
-
- return 0;
-
-destroy1:
- usb_free_urb(priv->rx_urb[i]);
-
-destroy:
- while (--i >= 0){
- kfree(priv->rx_urb[i]->transfer_buffer);
- usb_free_urb(priv->rx_urb[i]);
- }
-
- kfree(priv->rx_urb);
-
- priv->rx_urb = NULL;
- DMESGE("Endpoint Alloc Failure");
- return -ENOMEM;
-
-}
-
-void rtl8187_usb_deleteendpoints(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i;
-
- if(priv->rx_urb){
- for(i=0;i<MAX_RX_URB;i++){
- usb_kill_urb(priv->rx_urb[i]);
- kfree(priv->rx_urb[i]->transfer_buffer);
- usb_free_urb(priv->rx_urb[i]);
- }
- kfree(priv->rx_urb);
- priv->rx_urb = NULL;
-
- }
-
-}
-
-
-void rtl8187_set_rate(struct net_device *dev)
-{
- int i;
- u16 word;
- int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
-// priv->ieee80211->state == IEEE80211_LINKED){
- basic_rate = ieeerate2rtlrate(240);
- min_rr_rate = ieeerate2rtlrate(60);
- max_rr_rate = ieeerate2rtlrate(240);
-
-//
-// }else{
-// basic_rate = ieeerate2rtlrate(20);
-// min_rr_rate = ieeerate2rtlrate(10);
-// max_rr_rate = ieeerate2rtlrate(110);
-// }
-
- write_nic_byte(dev, RESP_RATE,
- max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT);
-
- word = read_nic_word(dev, BRSR);
- word &= ~BRSR_MBR_8185;
-
-
- for(i=0;i<=basic_rate;i++)
- word |= (1<<i);
-
- write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
-}
-
-
-void rtl8187_link_change(struct net_device *dev)
-{
-// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- //write_nic_word(dev, BintrItv, net->beacon_interval);
- rtl8187_net_update(dev);
- /*update timing params*/
- rtl8180_set_chan(dev, priv->chan);
-
- rtl8187_set_rxconf(dev);
-}
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv);
-
-short rtl8180_init(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i, j;
- u16 word;
- int ch;
- //u16 version;
- //u8 hw_version;
- //u8 config3;
-
- //FIXME: these constants are placed in a bad pleace.
-
-// priv->txbuffsize = 1024;
-// priv->txringcount = 32;
-// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
-// priv->txbeaconcount = 3;
-// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
- /* ^^ the SKB does not containt a partial RXed
- * packet (is empty)
- */
-
- if(!channels){
- DMESG("No channels, aborting");
- return -1;
- }
- ch=channels;
- // set channels 1..14 allowed in given locale
- for (i=1; i<=14; i++) {
- (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
- ch >>= 1;
- }
- //memcpy(priv->stats,0,sizeof(struct Stats));
-
- //priv->irq_enabled=0;
-
-// priv->stats.rxdmafail=0;
- priv->stats.txrdu=0;
-// priv->stats.rxrdu=0;
-// priv->stats.rxnolast=0;
-// priv->stats.rxnodata=0;
- //priv->stats.rxreset=0;
- //priv->stats.rxwrkaround=0;
-// priv->stats.rxnopointer=0;
- priv->stats.txnperr=0;
- priv->stats.txresumed=0;
-// priv->stats.rxerr=0;
-// priv->stats.rxoverflow=0;
-// priv->stats.rxint=0;
- priv->stats.txnpokint=0;
- /*priv->stats.txhpokint=0;
- priv->stats.txhperr=0;*/
- priv->stats.rxurberr=0;
- priv->stats.rxstaterr=0;
- priv->stats.txoverflow=0;
- priv->stats.rxok=0;
-// priv->stats.txbeaconerr=0;
- priv->stats.txlperr=0;
- priv->stats.txlpokint=0;
-
- priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
- priv->retry_rts = DEFAULT_RETRY_RTS;
- priv->retry_data = DEFAULT_RETRY_DATA;
- priv->ieee80211->rate = 110; //11 mbps
- priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
- priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
- spin_lock_init(&priv->tx_lock);
- INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
- sema_init(&priv->wx_sem,1);
- tasklet_init(&priv->irq_rx_tasklet,
- (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
- (unsigned long)priv);
-
- //priv->ieee80211->func =
- // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
- //memset(priv->ieee80211->func, 0,
- // sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
- priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
- IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
- /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
- priv->ieee80211->active_scan = 1;
- priv->ieee80211->rate = 110; //11 mbps
- priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
- priv->ieee80211->host_encrypt = 1;
- priv->ieee80211->host_decrypt = 1;
- priv->ieee80211->start_send_beacons = rtl8187_beacon_tx;
- priv->ieee80211->stop_send_beacons = rtl8187_beacon_stop;
- //priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit;
- priv->ieee80211->softmac_hard_start_xmit = NULL;
- priv->ieee80211->set_chan = rtl8180_set_chan;
- priv->ieee80211->link_change = rtl8187_link_change;
- priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit;
- priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop;
- priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
- //priv->ieee80211->start_send_beacons = NULL;
- //priv->ieee80211->stop_send_beacons = NULL;
-
- priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
- priv->card_8185 = 2;
- priv->phy_ver = 2;
- priv->card_type = USB;
-
- #if 0
- hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
- switch (hw_version){
- case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
- priv->card_8185 = 1;
- /* you should not find a card with 8225 PHY ver < C*/
- priv->phy_ver = 2;
- break;
-
- case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
- priv->card_8185 = 2;
- /* you should not find a card with 8225 PHY ver < C*/
- priv->phy_ver = 2;
- break;
-
- case HW_VERID_R8180_ABCD:
- DMESG("MAC controller is a RTL8180");
- priv->card_8185 = 0;
- break;
-
- case HW_VERID_R8180_F:
- DMESG("MAC controller is a RTL8180 (v. F)");
- priv->card_8185 = 0;
- break;
-
- default:
- DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
- priv->card_8185 = 0;
- break;
- }
-
-
- /* you should not found any 8185 Ver B Card */
- priv->card_8185_Bversion = 0;
-
- config3 = read_nic_byte(dev, CONFIG3);
- if(config3 & 0x8){
- priv->card_type = CARDBUS;
- DMESG("This is a CARDBUS NIC");
- }
- else if( config3 & 0x4){
- priv->card_type = MINIPCI;
- DMESG("This is a MINI-PCI NIC");
- }else{
- priv->card_type = PCI;
- DMESG("This is a PCI NIC");
- }
- #endif
- priv->enable_gpio0 = 0;
-
-
- /* commented out just because we already do
- this when resetting the card
- andrea 20050924
- */
- #if 0
-
- u8 txcr, txreg50;
- u32 txreg54, txreg60;
-
- /* enable A/D D/A register */
- txcr = read_nic_byte(dev, 0x59);
-// DMESG("<txcr:%x>", txcr);
- //write_nic_word(dev, 0x59, 0x44);
- write_nic_byte(dev, 0x59, 0x44);
- //write_nic_byte(dev, 0x59, 0xea);
- txcr = read_nic_byte(dev, 0x59);
-// DMESG("<<txcr:%x>>", txcr);
-
- txreg50 = read_nic_byte(dev, 0x50);
- // DMESG("<txreg50:%x>", txreg50);
- write_nic_byte(dev, 0x50, 0xc0);
- txreg50 = read_nic_byte(dev, 0x50);
- // DMESG("<<txreg50:%x>>", txreg50);
-
-
- txreg54 = read_nic_dword(dev, 0x54);
- // DMESG("<txreg54:%x>", txreg54);
- txreg54 = 0xa0000a59;
- // DMESG("<<txreg54:%x>>", txreg54);
- write_nic_dword(dev, 0x54, txreg54);
- txreg54 = read_nic_dword(dev, 0x54);
- // DMESG("<<<txreg54:%x>>>", txreg54);
-
- txreg60 = read_nic_dword(dev, 0x60);
- // DMESG("<txreg60:%x>", txreg60);
-
- write_nic_byte(dev, 0x50, 0x0);
- txcr = read_nic_byte(dev, 0x50);
- // DMESG("<<txcr:%x>>", txcr);
-
-#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
- if (RCR_9356SEL & read_nic_dword(dev, RCR)){
- priv->epromtype=EPROM_93c56;
- DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
- }else{
- priv->epromtype=EPROM_93c46;
- DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
- }
-
- dev->get_stats = rtl8180_stats;
-
- dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
- dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
- dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
- dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
- dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
- dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
- DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
- for(i=1,j=0; i<6; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW0 + j);
- priv->chtxpwr[i]=word & 0xf;
- priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
- priv->chtxpwr[i+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
- }
-
- for(i=1,j=0; i<4; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW1 + j);
- priv->chtxpwr[i+6]=word & 0xf;
- priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
- priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
- }
-
- for(i=1,j=0; i<4; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW2 + j);
- priv->chtxpwr[i+6+4]=word & 0xf;
- priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
- priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
- }
-
-
- priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
- word = eprom_read(dev,EPROM_TXPW_BASE);
- priv->cck_txpwr_base = word & 0xf;
- priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
- /* check RF frontend chipset */
-
- switch (priv->rf_chip) {
-
- case EPROM_RFCHIPID_RTL8225U:
-
- DMESG("Card reports RF frontend Realtek 8225");
- DMESGW("This driver has EXPERIMENTAL support for this chipset.");
- DMESGW("use it with care and at your own risk and");
- DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
- if(rtl8225_is_V_z2(dev)){
- priv->rf_init = rtl8225z2_rf_init;
- priv->rf_set_chan = rtl8225z2_rf_set_chan;
- priv->rf_set_sens = NULL;
- DMESG("This seems a new V2 radio");
- }else{
- priv->rf_init = rtl8225_rf_init;
- priv->rf_set_chan = rtl8225_rf_set_chan;
- priv->rf_set_sens = rtl8225_rf_set_sens;
- DMESG("This seems a legacy 1st version radio");
- }
- priv->rf_close = rtl8225_rf_close;
-
- priv->max_sens = RTL8225_RF_MAX_SENS;
- priv->sens = RTL8225_RF_DEF_SENS;
- break;
-
- default:
- DMESGW("Unknown RF module %x",priv->rf_chip);
- DMESGW("Exiting...");
- return -1;
-
- }
-
-// DMESG("Energy threshold: %x",priv->cs_treshold);
- DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
- //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
- DMESG("Endopoints initialization failed");
- return -ENOMEM;
- }
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_NORMPRIORITY_RING_ADDR))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_HIGHPRIORITY_RING_ADDR))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_LOWPRIORITY_RING_ADDR))
- return -ENOMEM;
-
-
- if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
- return -ENOMEM;
-#endif
-
-
-#ifdef DEBUG_EPROM
- dump_eprom(dev);
-#endif
- return 0;
-
-}
-
-void rtl8185_rf_pins_enable(struct net_device *dev)
-{
-/* u16 tmp;
- tmp = read_nic_word(dev, RFPinsEnable);*/
- write_nic_word(dev, RFPinsEnable, 0x1ff7);// | tmp);
-}
-
-
-void rtl8185_set_anaparam2(struct net_device *dev, u32 a)
-{
- u8 conf3;
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- write_nic_dword(dev, ANAPARAM2, a);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
-}
-
-
-void rtl8180_set_anaparam(struct net_device *dev, u32 a)
-{
- u8 conf3;
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- write_nic_dword(dev, ANAPARAM, a);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
-}
-
-
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
-{
- write_nic_byte(dev, TX_ANTENNA, ant);
- force_pci_posting(dev);
- mdelay(1);
-}
-
-
-void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
-{
- //u8 phyr;
- u32 phyw;
-// int i;
-
- adr |= 0x80;
-
- phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
- write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
- write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
- write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
- write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
-
- //read_nic_dword(dev, PHY_ADR);
-#if 0
- for(i=0;i<10;i++){
- write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
- phyr = read_nic_byte(dev, PHY_READ);
- if(phyr == (data&0xff)) break;
-
- }
-#endif
- /* this is ok to fail when we write AGC table. check for AGC table might be
- * done by masking with 0x7f instead of 0xff
- */
- //if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data, adr);
- mdelay(1);
-}
-
-
-inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data)
-{
- data = data & 0xff;
- rtl8187_write_phy(dev, adr, data);
-}
-
-
-void write_phy_cck (struct net_device *dev, u8 adr, u32 data)
-{
- data = data & 0xff;
- rtl8187_write_phy(dev, adr, data | 0x10000);
-}
-
-
-void rtl8180_adapter_start(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- //u32 anaparam;
- //u8 config3;
-
- //rtl8180_rtx_disable(dev);
- rtl8180_reset(dev);
-
- write_nic_byte(dev,0x85,0);
- write_nic_byte(dev,0x91,0);
-
- /* light blink! */
- write_nic_byte(dev,0x85,4);
- write_nic_byte(dev,0x91,1);
- write_nic_byte(dev,0x90,0);
-
- priv->irq_mask = 0xffff;
-/*
- priv->dma_poll_mask = 0;
- priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
-// rtl8180_beacon_tx_disable(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
- write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
- write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
- rtl8180_update_msr(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- write_nic_word(dev,0xf4,0xffff);
- write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
-
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
-
-#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
-#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
-
- write_nic_byte(dev, RATE_FALLBACK, 0x81);
- rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
-
- if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
- write_nic_word(dev,0x5e,1);
-
- #if 1
- //mdelay(1);
- write_nic_word(dev,0xfe,0x10);
-// mdelay(1);
- #endif
- write_nic_byte(dev, TALLY_SEL, 0x80);//Set NQ retry count
-
- write_nic_byte(dev, 0xff, 0x60);
-
- write_nic_word(dev,0x5e,0);
-
-
- rtl8180_irq_enable(dev);
- /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
- DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
- DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
- if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
- if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
- if(check_nic_enought_desc(dev,LOW_PRIORITY)) DMESG("LOW OK");*/
-}
-
-
-
-/* this configures registers for beacon tx and enables it via
- * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might
- * be used to stop beacon transmission
- */
-#if 0
-void rtl8180_start_tx_beacon(struct net_device *dev)
-{
- int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
- DMESG("Enabling beacon TX");
- //write_nic_byte(dev, 0x42,0xe6);// TCR
- //rtl8180_init_beacon(dev);
- //set_nic_txring(dev);
-// rtl8180_prepare_beacon(dev);
- rtl8180_irq_disable(dev);
-// rtl8180_beacon_tx_enable(dev);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- //write_nic_byte(dev,0x9d,0x20); //DMA Poll
- //write_nic_word(dev,0x7a,0);
- //write_nic_word(dev,0x7a,0x8000);
-
-
- word = read_nic_word(dev, BcnItv);
- word &= ~BcnItv_BcnItv; // clear Bcn_Itv
- write_nic_word(dev, BcnItv, word);
-
- write_nic_word(dev, AtimWnd,
- read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
- word = read_nic_word(dev, BintrItv);
- word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
- // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
- // FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
- write_nic_word(dev, BintrItv, word);
-
- //write_nic_word(dev,0x2e,0xe002);
- //write_nic_dword(dev,0x30,0xb8c7832e);
- for(i=0; i<ETH_ALEN; i++)
- write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
-// rtl8180_update_msr(dev);
-
-
- //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
- rtl8180_irq_enable(dev);
-
- /* VV !!!!!!!!!! VV*/
- /*
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-*/
-}
-#endif
-/***************************************************************************
- -------------------------------NET STUFF---------------------------
-***************************************************************************/
-static struct net_device_stats *rtl8180_stats(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return &priv->ieee80211->stats;
-}
-
-
-int _rtl8180_up(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- priv->up=1;
-
- //DMESG("Bringing up iface");
-
- rtl8180_adapter_start(dev);
-
- rtl8180_rx_enable(dev);
-
- rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
- if(!netif_queue_stopped(dev))
- netif_start_queue(dev);
- else
- netif_wake_queue(dev);
-
- return 0;
-}
-
-
-int rtl8180_open(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
- down(&priv->wx_sem);
- ret = rtl8180_up(dev);
- up(&priv->wx_sem);
- return ret;
-
-}
-
-
-int rtl8180_up(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 1) return -1;
-
- return _rtl8180_up(dev);
-}
-
-
-int rtl8180_close(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
- down(&priv->wx_sem);
-
- ret = rtl8180_down(dev);
-
- up(&priv->wx_sem);
-
- return ret;
-
-}
-
-int rtl8180_down(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 0) return -1;
-
- priv->up=0;
-
-/* FIXME */
- if (!netif_queue_stopped(dev))
- netif_stop_queue(dev);
-
- rtl8180_rtx_disable(dev);
- rtl8180_irq_disable(dev);
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
- return 0;
-}
-
-
-void rtl8180_commit(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
- rtl8180_irq_disable(dev);
- rtl8180_rtx_disable(dev);
- _rtl8180_up(dev);
-}
-
-void rtl8180_restart(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- down(&priv->wx_sem);
-
- rtl8180_commit(dev);
-
- up(&priv->wx_sem);
-}
-
-static void r8180_set_multicast(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- short promisc;
-
- //down(&priv->wx_sem);
-
- /* FIXME FIXME */
-
- promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
- if (promisc != priv->promisc)
- // rtl8180_commit(dev);
-
- priv->promisc = promisc;
-
- //schedule_work(&priv->reset_wq);
- //up(&priv->wx_sem);
-}
-
-
-int r8180_set_mac_adr(struct net_device *dev, void *mac)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct sockaddr *addr = mac;
-
- down(&priv->wx_sem);
-
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
- schedule_work(&priv->reset_wq);
-
- up(&priv->wx_sem);
-
- return 0;
-}
-
-
-/* based on ipw2200 driver */
-int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
- switch (cmd) {
- case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
- break;
-
- default:
- ret = -EOPNOTSUPP;
- break;
- }
-
- up(&priv->wx_sem);
-
- return ret;
-}
-
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv)
-{
- struct urb *rx_urb = priv->rxurb_task;
- struct net_device *dev = (struct net_device*)rx_urb->context;
- int status,len,flen;
- struct sk_buff *skb;
- u32 *desc;
-
- //DMESG("rtl8187_rx_isr");
-
- struct ieee80211_rx_stats stats = {
- .signal = 0,
- .noise = -98,
- .rate = 0,
- // .mac_time = jiffies,
- .freq = IEEE80211_24GHZ_BAND,
- };
-
- //DMESG("RX %d ",rx_urb->status);
- status = rx_urb->status;
- if(status == 0){
-
- len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
- len -= 4*4;/* 4 dword and 4 byte CRC */
-
- desc = (u32*)(rx_urb->transfer_buffer + len);
-
- flen = desc[0] & 0xfff;
-
- if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
- stats.mac_time[0] = desc[2];
- stats.mac_time[1] = desc[3];
- skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
- memcpy(skb_put(skb,flen-4),
- rx_urb->transfer_buffer,flen -4);
-
- #ifdef DUMP_RX
- int i;
- for(i=0;i<flen-4;i++)
- printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
- printk("------RATE %x:w---------------\n",stats.rate);
-
- #endif
- priv->stats.rxok++;
- // priv->rxskb = skb;
- // priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
- skb, &stats))
- dev_kfree_skb_any(skb);
- }
- }else priv->stats.rxurberr++;
- }else{
- priv->stats.rxstaterr++;
- priv->ieee80211->stats.rx_errors++;
-
- }
-
- if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
- else DMESG("RX process aborted due to explicit shutdown");
-}
-
-/****************************************************************************
- ---------------------------- USB_STUFF---------------------------
-*****************************************************************************/
-
-
-static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
-{
-// unsigned long ioaddr = 0;
- struct net_device *dev = NULL;
- struct r8180_priv *priv= NULL;
- struct usb_device *udev = interface_to_usbdev(intf);
-
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
- SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
- SET_NETDEV_DEV(dev, &intf->dev);
-
- priv = ieee80211_priv(dev);
- priv->ieee80211 = netdev_priv(dev);
-
- priv->udev=udev;
-
- dev->open = rtl8180_open;
- dev->stop = rtl8180_close;
- //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
- dev->tx_timeout = tx_timeout;
- dev->wireless_handlers = &r8180_wx_handlers_def;
- dev->do_ioctl = rtl8180_ioctl;
- dev->set_multicast_list = r8180_set_multicast;
- dev->set_mac_address = r8180_set_mac_adr;
- dev->get_wireless_stats = r8180_get_wireless_stats;
- dev->type=ARPHRD_ETHER;
-
- if (dev_alloc_name(dev, ifname) < 0){
- DMESG("Oops: devname already taken! Trying wlan%%d...\n");
- ifname = "wlan%d";
- dev_alloc_name(dev, ifname);
- }
-
-// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
- DMESG("Initialization failed");
- goto fail;
- }
-
- netif_carrier_off(dev);
- netif_stop_queue(dev);
-
- register_netdev(dev);
-
- rtl8180_proc_init_one(dev);
-
-
- DMESG("Driver probe completed\n");
- return 0;
-
-
-fail:
- free_ieee80211(dev);
-
- DMESG("wlan driver load failed\n");
-
- return -ENODEV;
-
-}
-
-
-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf)
-{
- struct r8180_priv *priv;
- struct net_device *dev = usb_get_intfdata(intf);
- if(dev){
-
- unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
- rtl8180_proc_remove_one(dev);
-
- rtl8180_down(dev);
- priv->rf_close(dev);
- //rtl8180_rtx_disable(dev);
- rtl8187_usb_deleteendpoints(dev);
- rtl8180_irq_disable(dev);
- rtl8180_reset(dev);
- mdelay(10);
-
- }
-// pci_disable_device(pdev);
- free_ieee80211(dev);
- DMESG("wlan driver removed\n");
-}
-
-
-static int __init rtl8187_usb_module_init(void)
-{
- printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
-based WLAN cards\n");
- printk(KERN_INFO "Copyright (c) 2004-2005, Andrea Merello\n");
- DMESG("Initializing module");
- DMESG("Wireless extensions version %d", WIRELESS_EXT);
- rtl8180_proc_module_init();
- return usb_register(&rtl8187_usb_driver);
-}
-
-
-static void __exit rtl8187_usb_module_exit(void)
-{
- usb_deregister(&rtl8187_usb_driver);
-
- rtl8180_proc_module_remove();
- DMESG("Exiting");
-}
-
-
-void rtl8180_try_wake_queue(struct net_device *dev, int pri)
-{
- unsigned long flags;
- short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- spin_lock_irqsave(&priv->tx_lock,flags);
- enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
- if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
-}
-
-
-
-/***************************************************************************
- ------------------- module init / exit stubs ----------------
-****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8187.h 2006-06-06 02:48:10.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h 2008-08-12 13:11:32.000000000 -0400
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,18 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+ short highpower;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +168,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +181,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +235,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +249,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8187.h~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/r8187.h~ 2006-06-05 22:58:02.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~ 1969-12-31 19:00:00.000000000 -0500
@@ -1,288 +0,0 @@
-/*
- This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
- Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
- official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
- from Patric Schenke & Andres Salomon
-
- Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
- project Authors.
-*/
-
-#ifndef R8180H
-#define R8180H
-
-
-#define RTL8187_MODULE_NAME "rtl8187"
-#define DMESG(x,a...) printk(KERN_INFO RTL8187_MODULE_NAME ": " x "\n", ## a)
-#define DMESGW(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": WW:" x "\n", ## a)
-#define DMESGE(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": EE:" x "\n", ## a)
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/netdevice.h>
-//#include <linux/pci.h>
-#include <linux/usb.h>
-#include <linux/etherdevice.h>
-#include <linux/delay.h>
-#include <linux/rtnetlink.h> //for rtnl_lock()
-#include <linux/wireless.h>
-#include <linux/timer.h>
-#include <linux/proc_fs.h> // Necessary because we use the proc fs
-#include <linux/if_arp.h>
-#include <linux/random.h>
-#include <linux/version.h>
-#include <asm/io.h>
-#include <asm/semaphore.h>
-
-#include "ieee80211.h"
-
-#define EPROM_93c46 0
-#define EPROM_93c56 1
-
-#define DEFAULT_FRAG_THRESHOLD 2342U
-#define MIN_FRAG_THRESHOLD 256U
-#define DEFAULT_BEACONINTERVAL 0x64U
-#define DEFAULT_BEACON_ESSID "Rtl8187"
-
-#define DEFAULT_SSID ""
-#define DEFAULT_RETRY_RTS 7
-#define DEFAULT_RETRY_DATA 7
-#define PRISM_HDR_SIZE 64
-
-#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30
-
-typedef struct buffer
-{
- struct buffer *next;
- u32 *buf;
-
-} buffer;
-
-#if 0
-
-typedef struct tx_pendingbuf
-{
- struct ieee80211_txb *txb;
- short ispending;
- short descfrag;
-} tx_pendigbuf;
-
-#endif
-
-typedef struct Stats
-{
- unsigned long txrdu;
-// unsigned long rxrdu;
- //unsigned long rxnolast;
- //unsigned long rxnodata;
-// unsigned long rxreset;
-// unsigned long rxwrkaround;
-// unsigned long rxnopointer;
- unsigned long rxok;
- unsigned long rxurberr;
- unsigned long rxstaterr;
- unsigned long txnperr;
- unsigned long txnpdrop;
- unsigned long txresumed;
-// unsigned long rxerr;
-// unsigned long rxoverflow;
-// unsigned long rxint;
- unsigned long txnpokint;
-// unsigned long txhpokint;
-// unsigned long txhperr;
-// unsigned long ints;
-// unsigned long shints;
- unsigned long txoverflow;
-// unsigned long rxdmafail;
-// unsigned long txbeacon;
-// unsigned long txbeaconerr;
- unsigned long txlpokint;
- unsigned long txlpdrop;
- unsigned long txlperr;
- unsigned long txdatapkt;
-} Stats;
-
-
-
-typedef struct r8180_priv
-{
- struct usb_device *udev;
- short epromtype;
- int irq;
- struct ieee80211_device *ieee80211;
-
- short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
- short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
- short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
- short enable_gpio0;
- enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
- short hw_plcp_len;
-
-// spinlock_t irq_lock;
-// spinlock_t irq_th_lock;
- spinlock_t tx_lock;
-
- u16 irq_mask;
-// short irq_enabled;
- struct net_device *dev;
- short chan;
- short sens;
- short max_sens;
- u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
- u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
- u8 cck_txpwr_base;
- u8 ofdm_txpwr_base;
- u8 challow[15]; //channels from 1 to 14, 0 not used
- short up;
- short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
-// struct timer_list scan_timer;
- /*short scanpending;
- short stopscan;*/
-// spinlock_t scan_lock;
-// u8 active_probe;
- //u8 active_scan_num;
- struct semaphore wx_sem;
-// short hw_wep;
-
-// short digphy;
-// short antb;
-// short diversity;
-// u8 cs_treshold;
-// short rcr_csense;
- short rf_chip;
-// u32 key0[4];
- short (*rf_set_sens)(struct net_device *dev,short sens);
- void (*rf_set_chan)(struct net_device *dev,short ch);
- void (*rf_close)(struct net_device *dev);
- void (*rf_init)(struct net_device *dev);
- //short rate;
- short promisc;
- /*stats*/
- struct Stats stats;
- struct iw_statistics wstats;
- struct proc_dir_entry *dir_dev;
-
- /*RX stuff*/
-// u32 *rxring;
-// u32 *rxringtail;
-// dma_addr_t rxringdma;
- struct urb **rx_urb;
-
- //struct buffer *rxbuffer;
- //struct buffer *rxbufferhead;
- //int rxringcount;
- //u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
-
- //short rx_skb_complete;
-
- //u32 rx_prevlen;
- atomic_t tx_lp_pending;
- atomic_t tx_np_pending;
-#if 0
- /*TX stuff*/
- u32 *txlpring;
- u32 *txhpring;
- u32 *txnpring;
- dma_addr_t txlpringdma;
- dma_addr_t txhpringdma;
- dma_addr_t txnpringdma;
- u32 *txlpringtail;
- u32 *txhpringtail;
- u32 *txnpringtail;
- u32 *txlpringhead;
- u32 *txhpringhead;
- u32 *txnpringhead;
- struct buffer *txlpbufs;
- struct buffer *txhpbufs;
- struct buffer *txnpbufs;
- struct buffer *txlpbufstail;
- struct buffer *txhpbufstail;
- struct buffer *txnpbufstail;
- int txringcount;
- int txbuffsize;
-
- //struct tx_pendingbuf txnp_pending;
- struct tasklet_struct irq_tx_tasklet;
-#endif
-// struct tasklet_struct irq_rx_tasklet;
-// u8 dma_poll_mask;
- //short tx_suspend;
-
- /* adhoc/master mode stuff */
-#if 0
- u32 *txbeacontail;
- dma_addr_t txbeaconringdma;
- u32 *txbeaconring;
- int txbeaconcount;
-#endif
-// struct ieee_tx_beacon *beacon_buf;
- //char *master_essid;
-// dma_addr_t beacondmabuf;
- //u16 master_beaconinterval;
-// u32 master_beaconsize;
- //u16 beacon_interval;
-
- u8 retry_data;
- u8 retry_rts;
-
- struct work_struct reset_wq;
-
-}r8180_priv;
-
-
-typedef enum{
- LOW_PRIORITY ,
- NORM_PRIORITY
- } priority_t;
-
-
-short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
-
-u8 read_nic_byte(struct net_device *dev, int x);
-u8 read_nic_byte_E(struct net_device *dev, int x);
-u32 read_nic_dword(struct net_device *dev, int x);
-u16 read_nic_word(struct net_device *dev, int x) ;
-void write_nic_byte(struct net_device *dev, int x,u8 y);
-void write_nic_byte_E(struct net_device *dev, int x,u8 y);
-void write_nic_word(struct net_device *dev, int x,u16 y);
-void write_nic_dword(struct net_device *dev, int x,u32 y);
-void force_pci_posting(struct net_device *dev);
-
-void rtl8180_rtx_disable(struct net_device *);
-void rtl8180_rx_enable(struct net_device *);
-void rtl8180_tx_enable(struct net_device *);
-
-void rtl8180_disassociate(struct net_device *dev);
-//void fix_rx_fifo(struct net_device *dev);
-void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a);
-
-void rtl8180_set_anaparam(struct net_device *dev,u32 a);
-void rtl8185_set_anaparam2(struct net_device *dev,u32 a);
-void rtl8180_update_msr(struct net_device *dev);
-int rtl8180_down(struct net_device *dev);
-int rtl8180_up(struct net_device *dev);
-void rtl8180_commit(struct net_device *dev);
-void rtl8180_set_chan(struct net_device *dev,short ch);
-void write_phy(struct net_device *dev, u8 adr, u8 data);
-void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
-void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
-void rtl8187_set_rxconf(struct net_device *dev);
-#endif
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/beta-8187/.tmp_versions/r8187.mod rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod
--- rtl8187_linux_26.1010.0622.2006_orig/beta-8187/.tmp_versions/r8187.mod 2006-06-22 01:40:15.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod 2008-08-12 13:11:32.000000000 -0400
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187.ko
-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187_core.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_93cx6.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_wx.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225z2.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.o
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt.c 2006-06-05 22:57:56.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c 2008-08-12 13:11:32.000000000 -0400
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt_ccmp.c 2006-06-05 22:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2008-08-12 13:11:32.000000000 -0400
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt.h 2006-06-05 22:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h 2008-08-12 13:11:32.000000000 -0400
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt_tkip.c 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c 2008-08-12 13:11:32.000000000 -0400
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,23 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 2, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +416,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +428,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +476,30 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,33 +533,59 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[0].page = virt_to_page(hdr);
sg[0].offset = offset_in_page(hdr);
sg[0].length = 16;
+#else
+ sg_set_page(&sg[0], virt_to_page(hdr), 16, offset_in_page(hdr));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[1].page = virt_to_page(data);
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#else
+ sg_set_page(&sg[1], virt_to_page(data), data_len, offset_in_page(data));
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +615,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +627,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +665,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +681,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +689,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +698,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +716,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +732,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +777,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +807,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +834,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_crypt_wep.c 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c 2008-08-12 13:11:32.000000000 -0400
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,25 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +214,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +244,26 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +284,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +298,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +311,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +320,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211.h 2006-06-05 22:57:56.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h 2008-08-12 14:23:20.000000000 -0400
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,21 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-
-extern inline void *ieee80211_priv(struct net_device *dev)
+#if WIRELESS_EXT >= 22
+static inline void *ieee80211_priv_rtl7(struct net_device *dev)
+#else
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
+#endif
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1200,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1226,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1254,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1401,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1419,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_module.c 2006-06-05 22:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c 2008-08-12 13:11:32.000000000 -0400
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_rx.c 2006-06-05 22:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c 2008-08-12 13:11:32.000000000 -0400
@@ -13,16 +13,15 @@
* more details.
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
-
+
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,89 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+#else
+ skb_reset_mac_header(skb);
+#endif
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +134,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +164,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +203,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +216,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +226,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +248,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,13 +257,13 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
-
+
return 0;
-
+
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
@@ -253,7 +323,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +364,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +374,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +409,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +419,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +437,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -413,7 +483,7 @@
last_seq = &ieee->last_seq_num;
last_frag = &ieee->last_frag_num;
last_time = &ieee->last_packet_time;
-
+
break;
default:
return 0;
@@ -436,7 +506,7 @@
drop:
// BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
// printk("DUP\n");
-
+
return 1;
}
@@ -444,7 +514,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -481,9 +551,9 @@
type = WLAN_FC_GET_TYPE(fc);
stype = WLAN_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctl);
-
+
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +571,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +599,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +625,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -573,9 +643,9 @@
goto rx_dropped;
}
#endif
-
-
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+
+
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -583,7 +653,7 @@
/* Data frame - extract src/dst addresses */
-
+
switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN);
@@ -606,7 +676,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +689,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +700,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +734,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +744,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +764,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +792,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +833,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -861,7 +931,12 @@
if (skb2 != NULL) {
/* send to wireless media */
skb2->protocol = __constant_htons(ETH_P_802_3);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb2->mac.raw = skb2->nh.raw = skb2->data;
+#else
+ skb_reset_mac_header(skb2);
+ skb_reset_network_header(skb2);
+#endif
/* skb2->nh.raw = skb2->data + ETH_HLEN; */
skb2->dev = dev;
dev_queue_xmit(skb2);
@@ -896,7 +971,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +988,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1039,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1066,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1089,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1043,47 +1118,47 @@
break;
case MFIE_TYPE_TIM:
-
- if(info_element->len < 4)
+
+ if(info_element->len < 4)
break;
-
+
network->dtim_period = info_element->data[1];
-
+
if(ieee->state != IEEE80211_LINKED)
break;
-
- network->last_dtim_sta_time[0] = stats->mac_time[0];
+
+ network->last_dtim_sta_time[0] = stats->mac_time[0];
network->last_dtim_sta_time[1] = stats->mac_time[1];
-
+
network->dtim_data = IEEE80211_DTIM_VALID;
-
- if(info_element->data[0] != 0)
+
+ if(info_element->data[0] != 0)
break;
-
+
if(info_element->data[2] & 1)
network->dtim_data |= IEEE80211_DTIM_MBCAST;
-
+
offset = (info_element->data[2] >> 1)*2;
-
- //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
-
- if(ieee->assoc_id < offset ||
+
+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
+
+ if(ieee->assoc_id < offset ||
ieee->assoc_id > 8*(offset + info_element->len -3))
-
+
break;
-
-
+
+
offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ;
-
- // printk("offset:%x data:%x, ucast:%d\n", offset,
+
+ // printk("offset:%x data:%x, ucast:%d\n", offset,
// info_element->data[3+offset] ,
// info_element->data[3+offset] & (1<<(ieee->assoc_id%8)));
-
+
if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
network->dtim_data |= IEEE80211_DTIM_UCAST;
-
+
break;
-
+
case MFIE_TYPE_IBSS_SET:
IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n");
break;
@@ -1115,7 +1190,7 @@
memcpy(network->rsn_ie, info_element,
network->rsn_ie_len);
break;
-
+
default:
IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
info_element->id);
@@ -1147,7 +1222,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,24 +1230,24 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
- * and the capability field (in particular IBSS and BSS) all match.
+ * and the capability field (in particular IBSS and BSS) all match.
* We treat all <hidden> with the same BSSID and channel
* as one network */
return ((src->ssid_len == dst->ssid_len) &&
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
- ((src->capability & WLAN_CAPABILITY_IBSS) ==
+ ((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
- ((src->capability & WLAN_CAPABILITY_BSS) ==
+ ((src->capability & WLAN_CAPABILITY_BSS) ==
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1194,7 +1269,7 @@
dst->dtim_data = src->dtim_data;
dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
-
+
memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len);
dst->wpa_ie_len = src->wpa_ie_len;
memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
@@ -1204,7 +1279,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1314,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1261,12 +1336,12 @@
* already there. */
spin_lock_irqsave(&ieee->lock, flags);
-
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
-
+
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
+
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1381,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1315,39 +1390,39 @@
WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
-
+
/* we have an entry and we are going to update it. But this entry may
- * be already expired. In this case we do the same as we found a new
+ * be already expired. In this case we do the same as we found a new
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_BEACON:
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
-
+
case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1430,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_softmac.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_softmac.c 2006-06-18 21:27:33.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c 2008-08-12 13:11:32.000000000 -0400
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,211 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
+ if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE);
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,166 +882,181 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1067,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1092,19 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
- printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+ printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10));
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1087,44 +1112,45 @@
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1158,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1218,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1311,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1338,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1477,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1488,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1631,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1656,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1670,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1687,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1717,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1739,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1767,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1790,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
{
-
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1887,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1918,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
- ieee->rate = 540;
+
+// ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
- ieee->rate = 110;
+// ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1963,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1973,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2025,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
+
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2149,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2181,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2258,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2279,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2291,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2315,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2348,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2399,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2416,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2455,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2469,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2490,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2573,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2585,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2600,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2629,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2645,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_softmac_wx.c 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c 2008-08-12 13:11:33.000000000 -0400
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_tx.c 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c 2008-08-12 13:11:33.000000000 -0400
@@ -24,15 +24,14 @@
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -299,27 +304,27 @@
}
if(likely(ieee->raw_tx == 0)){
-
+
if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
-
+
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-
+
crypt = ieee->crypt[ieee->tx_keyidx];
-
+
encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
ieee->host_encrypt && crypt && crypt->ops;
-
+
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
stats->tx_dropped++;
goto success;
}
-
+
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !encrypt && ether_type == ETH_P_PAE) {
struct eapol *eap = (struct eapol *)(skb->data +
@@ -328,23 +333,23 @@
eap_get_type(eap->type));
}
#endif
-
+
/* Save source and destination addresses */
memcpy(&dest, skb->data, ETH_ALEN);
memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
-
+
/* Advance the SKB to the start of the payload */
skb_pull(skb, sizeof(struct ethhdr));
-
+
/* Determine total amount of storage required for TXB packets */
bytes = skb->len + SNAP_SIZE + sizeof(u16);
-
+
if (encrypt)
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_WEP;
else
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
-
+
if (ieee->iw_mode == IW_MODE_INFRA) {
fc |= IEEE80211_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -360,9 +365,9 @@
memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
}
header.frame_ctl = cpu_to_le16(fc);
-
+
hdr_len = IEEE80211_3ADDR_LEN;
-
+
/* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */
if (is_multicast_ether_addr(dest) ||
@@ -370,7 +375,7 @@
frag_size = MAX_FRAG_THRESHOLD;
else
frag_size = ieee->fts;
-
+
/* Determine amount of payload per fragment. Regardless of if
* this stack is providing the full 802.11 header, one will
* eventually be affixed to this fragment -- so we must account for
@@ -379,12 +384,12 @@
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
bytes_per_frag -= IEEE80211_FCS_LEN;
-
+
/* Each fragment may need to have room for encryptiong pre/postfix */
if (encrypt)
bytes_per_frag -= crypt->ops->extra_prefix_len +
crypt->ops->extra_postfix_len;
-
+
/* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */
nr_frags = bytes / bytes_per_frag;
@@ -393,11 +398,11 @@
nr_frags++;
else
bytes_last_frag = bytes_per_frag;
-
+
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -405,93 +410,94 @@
}
txb->encrypted = encrypt;
txb->payload_size = bytes;
-
+
for (i = 0; i < nr_frags; i++) {
skb_frag = txb->fragments[i];
-
+
if (encrypt)
skb_reserve(skb_frag, crypt->ops->extra_prefix_len);
-
+
frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len);
memcpy(frag_hdr, &header, hdr_len);
-
+
/* If this is not the last fragment, then add the MOREFRAGS
* bit to the frame control */
if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16(
fc | IEEE80211_FCTL_MOREFRAGS);
bytes = bytes_per_frag;
-
+
} else {
/* The last fragment takes the remaining length */
bytes = bytes_last_frag;
}
-
+
frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i);
-
-
+
+
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
}
-
+
memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
-
+
/* Advance the SKB... */
skb_pull(skb, bytes);
-
+
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
}
- // Advance sequence number in data frame.
+ // Advance sequence number in data frame.
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
- }
+ }
success:
spin_unlock_irqrestore(&ieee->lock, flags);
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
-
-
+
+
}
return 0;
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/ieee80211_wx.c 2006-06-05 22:57:56.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c 2008-08-12 14:23:46.000000000 -0400
@@ -40,8 +40,9 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
- char *start, char *stop,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
+ char *start, char *stop,
struct ieee80211_network *network)
{
char custom[MAX_CUSTOM_LEN];
@@ -54,7 +55,11 @@
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN);
+#endif
/* Remaining entries will be displayed in the order we provide them */
@@ -63,16 +68,28 @@
iwe.u.data.flags = 1;
if (network->flags & NETWORK_EMPTY_ESSID) {
iwe.u.data.length = sizeof("<hidden>");
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>");
+#else
start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
+#endif
} else {
iwe.u.data.length = min(network->ssid_len, (u8)32);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
+#else
start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
+#endif
}
/* Add the protocol name */
iwe.cmd = SIOCGIWNAME;
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN);
+#endif
/* Add mode */
iwe.cmd = SIOCGIWMODE;
@@ -83,8 +100,13 @@
else
iwe.u.mode = IW_MODE_ADHOC;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe,
+ IW_EV_UINT_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe,
IW_EV_UINT_LEN);
+#endif
}
/* Add frequency/channel */
@@ -94,7 +116,11 @@
iwe.u.freq.m = network->channel;
iwe.u.freq.e = 0;
iwe.u.freq.i = 0;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);
+#endif
/* Add encryption capability */
iwe.cmd = SIOCGIWENCODE;
@@ -103,7 +129,11 @@
else
iwe.u.data.flags = IW_ENCODE_DISABLED;
iwe.u.data.length = 0;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
+#else
start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
+#endif
/* Add basic and extended rates */
max_rate = 0;
@@ -132,13 +162,22 @@
iwe.cmd = SIOCGIWRATE;
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
iwe.u.bitrate.value = max_rate * 500000;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe,
+ IW_EV_PARAM_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe,
IW_EV_PARAM_LEN);
+#endif
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+#else
start = iwe_stream_add_point(start, stop, &iwe, custom);
+#endif
/* Add quality statistics */
/* TODO: Fix these values... */
@@ -154,14 +193,22 @@
if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL))
iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);
+#endif
iwe.cmd = IWEVCUSTOM;
p = custom;
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+#else
start = iwe_stream_add_point(start, stop, &iwe, custom);
+#endif
if (ieee->wpa_enabled && network->wpa_ie_len){
char buf[MAX_WPA_IE_LEN * 2 + 30];
@@ -175,7 +222,12 @@
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = strlen(buf);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, buf);
+#else
start = iwe_stream_add_point(start, stop, &iwe, buf);
+#endif
+
}
if (ieee->wpa_enabled && network->rsn_ie_len){
@@ -190,7 +242,11 @@
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = strlen(buf);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, buf);
+#else
start = iwe_stream_add_point(start, stop, &iwe, buf);
+#endif
}
/* Add EXTRA: Age to display seconds since last beacon/probe response
@@ -201,13 +257,17 @@
" Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100));
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+#else
start = iwe_stream_add_point(start, stop, &iwe, custom);
+#endif
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +280,15 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, info, ev,
+stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +309,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -259,6 +321,9 @@
int i, key, key_provided, len;
struct ieee80211_crypt_data **crypt;
+ if (erq->flags & IW_ENCODE_RESTRICTED)
+ return -EINVAL;
+
IEEE80211_DEBUG_WX("SET_ENCODE\n");
key = erq->flags & IW_ENCODE_INDEX;
@@ -281,7 +346,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +356,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +379,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +391,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +405,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +483,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +495,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +535,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/Makefile 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile 2008-08-12 13:11:33.000000000 -0400
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/Modules.symvers rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/Modules.symvers 2006-06-05 22:57:56.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers 1969-12-31 19:00:00.000000000 -0500
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2008-08-12 13:11:33.000000000 -0400
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.o
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2008-08-12 13:11:33.000000000 -0400
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.o
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2008-08-12 13:11:33.000000000 -0400
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.o
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2008-08-12 13:11:33.000000000 -0400
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.o
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod
--- rtl8187_linux_26.1010.0622.2006_orig/ieee80211/.tmp_versions/ieee80211-rtl.mod 2006-06-05 22:57:54.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod 2008-08-12 13:11:33.000000000 -0400
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_rx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_tx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_wx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_module.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac_wx.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.o
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/makedrv~ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~
--- rtl8187_linux_26.1010.0622.2006_orig/makedrv~ 2006-09-05 07:21:10.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~ 1969-12-31 19:00:00.000000000 -0500
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-#tar -zxvf stack.tar.gz
-#tar -zxvf drv.tar.gz
-cd ieee80211
-make clean
-make
-cd ../beta-8187
-make clean
-make
-cd ..
-
-
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/Makefile
--- rtl8187_linux_26.1010.0622.2006_orig/Makefile 1969-12-31 19:00:00.000000000 -0500
+++ rtl8187_linux_26.1010.0622.2006_rawtx/Makefile 2008-08-12 13:11:33.000000000 -0400
@@ -0,0 +1,38 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/ReadMe.txt~ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~
--- rtl8187_linux_26.1010.0622.2006_orig/ReadMe.txt~ 2006-06-06 10:58:00.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~ 1969-12-31 19:00:00.000000000 -0500
@@ -1,129 +0,0 @@
-Release Date: 2006-01-13, ver 1.1
-RTL8187 Linux driver version 1.1
-
- --This driver supports RealTek RTL8187 Wireless LAN driver for
- Fedora Core 2/3/4/5, Debian 3.1, Mandrake 10.2/Mandriva 2006,
- SUSE 9.3/10.1/10.2, Gentoo 3.1, etc.
- - Support Client mode for either infrastructure or adhoc mode
- - Support WEP and WPAPSK connection
-
-< Component >
-The driver is composed of several parts:
- 1. Module source code
- stack.tar.gz
- drv.tar.gz
-
- 2. Script ot build the modules
- makedrv
-
- 3. Script to load/unload modules
- wlan0up
- wlan0down
-
- 4. Script and configuration for DHCP
- wlan0dhcp
- ifcfg-wlan0
- 4. Supplicant source code:
- wpa_supplicant-0.4.9.tar.gz
-
- 5. Example of supplicant configuration file:
- wpa1.conf
-
-< Installation >
-Runing the scripts can finish all operations of building up modules
-from the source code and start the nic.
- 1. Build up the drivers from the source code
- ./makedrv
-
- 2. load the driver module to kernel and start up nic
- ./wlan0up
-
-< Set wireless lan MIBs >
-This driver uses Wireless Extension as an interface allowing you to set
-Wireless LAN specific parameters.
-
-Current driver supports "iwlist" to show the device status of nic
- iwlist wlan0 [parameters]
-where
- parameter explaination [parameters]
- ----------------------- -------------
- Show available chan and freq freq / channel
- Show and Scan BSS and IBSS scan[ning]
- Show supported bit-rate rate / bit[rate]
- Show Power Management mode power
-
-For example:
- iwlist wlan0 channel
- iwlist wlan0 scan
- iwlist wlan0 rate
- iwlist wlan0 power
-
-Driver also supports "iwconfig", manipulate driver private ioctls, to set
-MIBs.
-
- iwconfig wlan0 [parameters] [val]
-where
- parameter explaination [parameters] [val] constraints
- ----------------------- ------------- ------------------
- Connect to AP by address ap [mac_addr]
- Set the essid, join (I)BSS essid [essid]
- Set operation mode mode {Managed|Ad-hoc}
- Set keys and security mode key/enc[ryption] {N|open|restricted|off}
-
-For example:
- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
- iwconfig wlan0 essid "ap_name"
- iwconfig wlan0 mode Ad-hoc
- iwconfig wlan0 mode essid "name" mode Ad-hoc
- iwconfig wlan0 key 0123456789 [2] open
- iwconfig wlan0 key off
- iwconfig wlan0 key restricted [3] 0123456789
-
-< Getting IP address >
-After start up the nic, the network needs to obtain an IP address before
-transmit/receive data.
-This can be done by setting the static IP via "ifconfig wlan0 IP_ADDRESS"
-command, or using DHCP.
-
-If using DHCP, setting steps is as below:
- (1)connect to an AP via "iwconfig" settings
- iwconfig wlan0 essid [name] or
- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
-
- (2)run the script which run the dhclient
- ./wlan0dhcp
-
-< WPAPSK >
-WPA_SUPPLICANT help the network to communicate under the protection of WPAPSK
-mechanism
-
- (1)Unpack source code of WPA supplicant:
- tar -zxvf wpa_supplicant-0.4.9.tar.gz
- cd wpa_supplicant-0.4.9
-
- (2)Create .config file:
- cp defconfig .config
-
- (3)Edit .config file, uncomment the following line:
- #CONFIG_DRIVER_IPW=y.
-
- (4)Build WPA supplicant:
- make
-
- (5)Edit wpa_supplicant.conf to set up SSID and its passphrase.
- For example, the following setting in "wpa1.conf" means SSID
- to join is "BufAG54_Ch6" and its passphrase is "87654321".
- network={
- ssid="BufAG54_Ch6"
- proto=WPA
- key_mgmt=WPA-PSK
- pairwise=CCMP TKIP
- group=CCMP TKIP WEP104 WEP40
- psk="87654321"
- priority=2
- }
-
- (6)Execute WPA supplicant (Assume 8187 and related modules had been
- loaded):
- ./wpa_supplicant -D ipw -c wpa1.conf -i wlan0 &
-
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/symvers rtl8187_linux_26.1010.0622.2006_rawtx/symvers
--- rtl8187_linux_26.1010.0622.2006_orig/symvers 1969-12-31 19:00:00.000000000 -0500
+++ rtl8187_linux_26.1010.0622.2006_rawtx/symvers 2008-08-12 13:11:33.000000000 -0400
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_linux_26.1010.0622.2006_orig/wlan0rmv rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv
--- rtl8187_linux_26.1010.0622.2006_orig/wlan0rmv 2006-09-05 07:21:10.000000000 -0400
+++ rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv 2008-08-12 13:11:33.000000000 -0400
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmod rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
Patch | aircrack-ng/patches/rtl8187_2.6.32.patch | diff -udpr rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006_2.6.32/beta-8187/r8187.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2010-01-31 11:32:06.000000000 -0500
+++ rtl8187_linux_26.1010.0622.2006_2.6.32/beta-8187/r8187.h 2010-01-31 09:28:57.000000000 -0500
@@ -43,12 +43,14 @@
#include <linux/if_arp.h>
#include <linux/random.h>
#include <linux/version.h>
-#include <asm/io.h>
-#include <asm/semaphore.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <asm/io.h>
+#include <asm/semaphore.h>
#include <linux/config.h>
#else
+#include <linux/io.h>
+#include <linux/semaphore.h>
#include <linux/autoconf.h>
#endif
diff -udpr rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006_2.6.32/beta-8187/r8187_core.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2010-01-31 11:32:05.000000000 -0500
+++ rtl8187_linux_26.1010.0622.2006_2.6.32/beta-8187/r8187_core.c 2010-01-31 11:15:27.000000000 -0500
@@ -1893,8 +1893,6 @@ short rtl8180_init(struct net_device *de
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
- dev->get_stats = rtl8180_stats;
-
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
@@ -2597,6 +2595,19 @@ void rtl8180_irq_rx_tasklet(struct r8180
---------------------------- USB_STUFF---------------------------
*****************************************************************************/
+#ifdef HAVE_NET_DEVICE_OPS
+static const struct net_device_ops rtl8180_netdev_ops = {
+ .ndo_open = rtl8180_open,
+ .ndo_stop = rtl8180_close,
+ .ndo_get_stats = rtl8180_stats,
+ .ndo_tx_timeout = tx_timeout,
+ .ndo_do_ioctl = rtl8180_ioctl,
+ .ndo_set_multicast_list = r8180_set_multicast,
+ .ndo_set_mac_address = r8180_set_mac_adr,
+ .ndo_start_xmit = ieee80211_xmit_rtl7,
+// .ndo_start_xmit = ieee80211_xmit,
+};
+#endif
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
@@ -2622,14 +2633,20 @@ static int __devinit rtl8187_usb_probe(s
priv->udev=udev;
+#ifdef HAVE_NET_DEVICE_OPS
+ dev->netdev_ops = &rtl8180_netdev_ops;
+#else
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
+ dev->get_stats = rtl8180_stats;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
dev->tx_timeout = tx_timeout;
dev->wireless_handlers = &r8180_wx_handlers_def;
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#endif
+
#if WIRELESS_EXT >= 12
#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
diff -udpr rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006_2.6.32/ieee80211/ieee80211_module.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2010-01-31 11:32:06.000000000 -0500
+++ rtl8187_linux_26.1010.0622.2006_2.6.32/ieee80211/ieee80211_module.c 2010-01-31 09:25:48.000000000 -0500
@@ -117,8 +117,12 @@ struct net_device *alloc_ieee80211_rtl7(
IEEE80211_ERROR("Unable to network device.\n");
goto failed;
}
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit_rtl7;
+#else
+ ieee = (struct ieee80211_device *)dev->priv;
+#endif
ieee->dev = dev;
diff -udpr rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006_2.6.32/ieee80211/ieee80211_rx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2010-01-31 11:28:19.000000000 -0500
+++ rtl8187_linux_26.1010.0622.2006_2.6.32/ieee80211/ieee80211_rx.c 2010-01-31 11:49:16.000000000 -0500
@@ -104,7 +104,12 @@ static inline void ieee80211_monitor_rx_
hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
- LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+
+ hdr->mactime.did = LWNG_CAP_DID_BASE | (2 << 12);
+ hdr->mactime.status = 0;
+ hdr->mactime.len = 4;
+ hdr->mactime.data = rx_stats->mac_time[0];
+
LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
diff -udpr rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006_2.6.32/ieee80211/ieee80211_tx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2010-01-31 11:32:06.000000000 -0500
+++ rtl8187_linux_26.1010.0622.2006_2.6.32/ieee80211/ieee80211_tx.c 2010-01-31 11:17:55.000000000 -0500
@@ -511,3 +511,4 @@ int ieee80211_xmit_rtl7(struct sk_buff *
}
EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
+EXPORT_SYMBOL(ieee80211_xmit_rtl7); |
Patch | aircrack-ng/patches/rtl8187_2.6.35-monitor_only.patch | diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h 2006-06-05 19:58:02.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/ieee80211_crypt.h 2010-05-19 22:18:51.849360466 -0700
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h 2006-06-05 19:58:02.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/ieee80211.h 2010-05-19 22:18:51.852693450 -0700
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,21 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-
-extern inline void *ieee80211_priv(struct net_device *dev)
+#if WIRELESS_EXT >= 22
+static inline void *ieee80211_priv_rtl7(struct net_device *dev)
+#else
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
+#endif
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1200,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1226,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1254,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1401,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1419,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile rtl8187_linux_26.1010.0622.2006.modified/beta-8187/Makefile
--- rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile 2006-06-05 19:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/Makefile 2010-05-19 22:18:51.859361932 -0700
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/modules.order rtl8187_linux_26.1010.0622.2006.modified/beta-8187/modules.order
--- rtl8187_linux_26.1010.0622.2006/beta-8187/modules.order 1969-12-31 16:00:00.000000000 -0800
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/modules.order 2010-05-19 22:24:09.389327640 -0700
@@ -0,0 +1 @@
+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.ko
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/Module.symvers rtl8187_linux_26.1010.0622.2006.modified/beta-8187/Module.symvers
--- rtl8187_linux_26.1010.0622.2006/beta-8187/Module.symvers 1969-12-31 16:00:00.000000000 -0800
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/Module.symvers 2010-05-19 22:24:10.342666003 -0700
@@ -0,0 +1,41 @@
+0x00000000 ieee80211_softmac_start_protocol_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 free_ieee80211_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_name_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_mode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_mode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_rate_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_rate_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_scan_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_scan_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_freq_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_freq_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_register_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_ps_tx_ack_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_rx_mgt_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_unregister_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_essid_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_essid_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_stop_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_rx_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_crypt_deinit_handler_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_wap_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_wap_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wlan_frequencies_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_get_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_xmit_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_power_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_power_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_crypt_deinit_entries_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_is_54g_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_get_beacon_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_is_shortslot_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_rawtx_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_reset_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_softmac_stop_protocol_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wpa_supplicant_ioctl_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 alloc_ieee80211_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_txb_free_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wake_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_crypt_delayed_deinit_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_encode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_encode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_93cx6.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c 2006-06-05 19:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_93cx6.c 2010-05-19 22:18:51.859361932 -0700
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_hw.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h 2006-06-05 19:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_hw.h 2010-05-19 22:18:51.862696872 -0700
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c 2006-06-05 19:58:02.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225.c 2010-05-19 22:18:51.866039146 -0700
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h 2006-06-05 19:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225.h 2010-05-19 22:18:51.866039146 -0700
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225z2.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c 2006-06-05 19:58:02.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_rtl8225z2.c 2010-05-19 22:18:51.876029926 -0700
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 1
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,48 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
- max_cck_power_level = 15;
+
+
+ max_cck_power_level = 35;
//min_cck_power_level = 0;
- max_ofdm_power_level = 25; // 12 -> 25
+ max_ofdm_power_level = 35; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+ if(cck_power_level >= 20 && cck_power_level < 30)
+ cck_power_level = 19;
+
for(i=0;i<8;i++){
-
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +482,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +511,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +557,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +626,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +681,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +711,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +741,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +772,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +799,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +824,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +852,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +902,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +915,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x86); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +980,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1007,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1024,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_wx.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c 2006-06-05 19:58:02.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8180_wx.c 2010-05-19 22:18:51.882696872 -0700
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,228 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(!(priv->highpower) && wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > 35)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+// if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+// if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
+ up(&priv->wx_sem);
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_highpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ int i=0;
+ short prev = priv->highpower;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->highpower=1;
+ else
+ priv->highpower=0;
+
+ DMESG("Increasable transmission power %s",
+ priv->highpower ? "enabled" : "disabled");
+
+ if( (prev != priv->highpower) && !(priv->highpower) && (priv->chtxpwr[1] > priv->chtxpwr_orig[1]) )
+ {
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i];
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i];
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+ wrqu->power.value = priv->txpwr_max;
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +307,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +340,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +364,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +388,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +407,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +459,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +490,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +498,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +518,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +568,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +606,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +624,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +654,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +692,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +744,55 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "highpower"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
+ },
+
+ {
+ SIOCIWFIRSTPRIV + 0x3,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_highpower, /*SIOCIWSECONDPRIV*/
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +805,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187_core.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2006-06-21 22:43:30.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187_core.c 2010-05-19 22:18:55.642702808 -0700
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,35 +414,44 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
+#else
+ rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net);
+#endif
}
void rtl8180_proc_module_remove(void)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
+#else
+ remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net);
+#endif
}
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +468,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +480,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +489,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +508,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +544,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +560,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +582,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +604,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +623,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +637,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +659,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +779,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +823,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +848,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +886,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +913,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +930,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +955,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +967,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +980,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +996,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +1006,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1022,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1046,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1078,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1129,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1142,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1156,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1177,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1209,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1224,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1239,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1248,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1256,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1304,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1323,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1381,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1392,20 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1417,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1430,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1443,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1485,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1502,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1601,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1612,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1633,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1660,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1687,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1728,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1775,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1835,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1883,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1892,71 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
- dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1973,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2008,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2037,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2057,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2081,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2127,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2193,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2216,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2230,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2274,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2413,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2431,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2451,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2462,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2475,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2585,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2387,6 +2595,19 @@
---------------------------- USB_STUFF---------------------------
*****************************************************************************/
+#ifdef HAVE_NET_DEVICE_OPS
+static const struct net_device_ops rtl8180_netdev_ops = {
+ .ndo_open = rtl8180_open,
+ .ndo_stop = rtl8180_close,
+ .ndo_get_stats = rtl8180_stats,
+ .ndo_tx_timeout = tx_timeout,
+ .ndo_do_ioctl = rtl8180_ioctl,
+ .ndo_set_multicast_list = r8180_set_multicast,
+ .ndo_set_mac_address = r8180_set_mac_adr,
+ .ndo_start_xmit = ieee80211_xmit_rtl7,
+// .ndo_start_xmit = ieee80211_xmit,
+};
+#endif
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
@@ -2396,63 +2617,76 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+#endif
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
+#ifdef HAVE_NET_DEVICE_OPS
+ dev->netdev_ops = &rtl8180_netdev_ops;
+#else
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
+ dev->get_stats = rtl8180_stats;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
dev->tx_timeout = tx_timeout;
dev->wireless_handlers = &r8180_wx_handlers_def;
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#endif
+
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2695,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2712,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2729,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2742,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2757,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187_core.c~
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ 2006-06-21 22:40:10.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187_core.c~ 1969-12-31 16:00:00.000000000 -0800
@@ -1,2527 +0,0 @@
-/*
- This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
- Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
- from Patric Schenke & Andres Salomon.
-
- Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
- some ideas might be derived from David Young rtl8180 netbsd driver.
-
- Parts of the usb code are from the r8150.c driver in linux kernel
-
- Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
- Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
-
- - Please note that this file is a modified version from rtl8180-sa2400
- drv. So some other people have contributed to this project, and they are
- thanked in the rtl8180-sa2400 CHANGELOG.
-*/
-
-#ifndef CONFIG_FORCE_HARD_FLOAT
-double __floatsidf (int i) { return i; }
-unsigned int __fixunsdfsi (double d) { return d; }
-double __adddf3(double a, double b) { return a+b; }
-double __addsf3(float a, float b) { return a+b; }
-double __subdf3(double a, double b) { return a-b; }
-double __extendsfdf2(float a) {return a;}
-#endif
-
-#undef LOOP_TEST
-#undef DUMP_RX
-#undef DUMP_TX
-#undef DEBUG_TX_DESC2
-#undef RX_DONT_PASS_UL
-#undef DEBUG_EPROM
-#undef DEBUG_RX_VERBOSE
-#undef DUMMY_RX
-#undef DEBUG_ZERO_RX
-#undef DEBUG_RX_SKB
-#undef DEBUG_TX_FRAG
-#undef DEBUG_RX_FRAG
-#undef DEBUG_TX_FILLDESC
-#undef DEBUG_TX
-#undef DEBUG_IRQ
-#undef DEBUG_RX
-#undef DEBUG_RXALLOC
-#undef DEBUG_REGISTERS
-#undef DEBUG_RING
-#undef DEBUG_IRQ_TASKLET
-#undef DEBUG_TX_ALLOC
-#undef DEBUG_TX_DESC
-
-//#define CONFIG_RTL8180_IO_MAP
-
-#include "r8180_hw.h"
-#include "r8187.h"
-#include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
-#include "r8180_93cx6.h" /* Card EEPROM */
-#include "r8180_wx.h"
-
-
-// FIXME: check if 2.6.7 is ok
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
-#define usb_kill_urb usb_unlink_urb
-#endif
-
-#ifdef CONFIG_RTL8180_PM
-#include "r8180_pm.h"
-#endif
-
-#ifndef USB_VENDOR_ID_REALTEK
-#define USB_VENDOR_ID_REALTEK 0x0bda
-#endif
-#ifndef USB_VENDOR_ID_NETGEAR
-#define USB_VENDOR_ID_NETGEAR 0x0846
-#endif
-
-static struct usb_device_id rtl8187_usb_id_tbl[] = {
- {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)},
- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)},
- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6a00)},
-
- {}
-};
-
-static char* ifname = "wlan%d";
-#if 0
-static int hwseqnum = 0;
-static int hwwep = 0;
-#endif
-static int channels = 0x3fff;
-
-MODULE_LICENSE("GPL");
-MODULE_VERSION("V 1.1");
-MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
-MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
-MODULE_DESCRIPTION("Linux driver for Realtek RTL8187 WiFi cards");
-
-#if 0
-MODULE_PARM(ifname,"s");
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-
-MODULE_PARM(hwseqnum,"i");
-MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-
-MODULE_PARM(hwwep,"i");
-MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-
-MODULE_PARM(channels,"i");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
-module_param(ifname, charp, S_IRUGO|S_IWUSR );
-//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
-//module_param(hwwep,int, S_IRUGO|S_IWUSR);
-module_param(channels,int, S_IRUGO|S_IWUSR);
-#else
-MODULE_PARM(ifname, "s");
-//MODULE_PARM(hwseqnum,"i");
-//MODULE_PARM(hwwep,"i");
-MODULE_PARM(channels,"i");
-#endif
-
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-//MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-
-static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id);
-
-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
-
-static struct usb_driver rtl8187_usb_driver = {
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
- .owner = THIS_MODULE,
-#endif
- .name = RTL8187_MODULE_NAME, /* Driver name */
- .id_table = rtl8187_usb_id_tbl, /* PCI_ID table */
- .probe = rtl8187_usb_probe, /* probe fn */
- .disconnect = rtl8187_usb_disconnect, /* remove fn */
-#ifdef CONFIG_RTL8180_PM
- .suspend = rtl8180_suspend, /* PM suspend fn */
- .resume = rtl8180_resume, /* PM resume fn */
-#else
- .suspend = NULL, /* PM suspend fn */
- .resume = NULL, /* PM resume fn */
-#endif
-};
-
-
-void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xfe00, 0, &data, 1, HZ / 2);
-}
-
-
-void write_nic_byte(struct net_device *dev, int indx, u8 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 1, HZ / 2);
-}
-
-
-void write_nic_word(struct net_device *dev, int indx, u16 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 2, HZ / 2);
-}
-
-
-void write_nic_dword(struct net_device *dev, int indx, u32 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 4, HZ / 2);
-}
-
-
-
-u8 read_nic_byte(struct net_device *dev, int indx)
-{
- u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 1, HZ / 2);
- return data;
-}
-
-u8 read_nic_byte_E(struct net_device *dev, int indx)
-{
- u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xfe00, 0, &data, 1, HZ / 2);
- return data;
-}
-
-
-u16 read_nic_word(struct net_device *dev, int indx)
-{
- u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 2, HZ / 2);
- return data;
-}
-
-
-u32 read_nic_dword(struct net_device *dev, int indx)
-{
- u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 4, HZ / 2);
- return data;
-}
-
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
- * plans are to possibilty turn it again in one common code...
- */
-inline void force_pci_posting(struct net_device *dev)
-{
-}
-
-
-//irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs);
-//void set_nic_rxring(struct net_device *dev);
-//void set_nic_txring(struct net_device *dev);
-static struct net_device_stats *rtl8180_stats(struct net_device *dev);
-void rtl8180_commit(struct net_device *dev);
-void rtl8180_restart(struct net_device *dev);
-
-/****************************************************************************
- -----------------------------PROCFS STUFF-------------------------
-*****************************************************************************/
-
-static struct proc_dir_entry *rtl8180_proc = NULL;
-
-static int proc_get_registers(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
- int i,n;
-
- int max=0xff;
-
- /* This dump the current register page */
- for(n=0;n<=max;)
- {
- //printk( "\nD: %2x> ", n);
- len += snprintf(page + len, count - len,
- "\nD: %2x > ",n);
-
- for(i=0;i<16 && n<=max;i++,n++)
- len += snprintf(page + len, count - len,
- "%2x ",read_nic_byte(dev,n));
-
- // printk("%2x ",read_nic_byte(dev,n));
- }
- len += snprintf(page + len, count - len,"\n");
-
-
-
- *eof = 1;
- return len;
-
-}
-
-#if 0
-static int proc_get_stats_hw(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "NIC int: %lu\n"
- "Total int: %lu\n",
- priv->stats.ints,
- priv->stats.shints);
-
- *eof = 1;
- return len;
-}
-#endif
-
-static int proc_get_stats_tx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "TX normal priority ok int: %lu\n"
- "TX normal priority error int: %lu\n"
-// "TX high priority ok int: %lu\n"
-// "TX high priority failed error int: %lu\n"
- "TX low priority ok int: %lu\n"
- "TX low priority failed error int: %lu\n"
- "TX queue resume: %lu\n"
- "TX queue stopped?: %d\n"
- "TX fifo overflow: %lu\n"
-// "TX beacon: %lu\n"
- "TX lp queue: %d\n"
- "TX np queue: %d\n"
- "TX HW queue: %d\n"
- "TX lp dropped: %lu\n"
- "TX np dropped: %lu\n"
- "TX total data packets %lu\n",
-// "TX beacon aborted: %lu\n",
- priv->stats.txnpokint,
- priv->stats.txnperr,
-// priv->stats.txhpokint,
-// priv->stats.txhperr,
- priv->stats.txlpokint,
- priv->stats.txlperr,
- priv->stats.txresumed,
- netif_queue_stopped(dev),
- priv->stats.txoverflow,
-// priv->stats.txbeacon,
- atomic_read(&(priv->tx_lp_pending)),
- atomic_read(&(priv->tx_np_pending)),
- read_nic_byte(dev, TXFIFOCOUNT),
- priv->stats.txlpdrop,
- priv->stats.txnpdrop,
- priv->stats.txdatapkt
-// priv->stats.txbeaconerr
- );
-
- *eof = 1;
- return len;
-}
-
-
-
-static int proc_get_stats_rx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "RX packets: %lu\n"
- "RX urb status error: %lu\n"
- "RX invalid urb error: %lu\n",
- priv->stats.rxok,
- priv->stats.rxstaterr,
- priv->stats.rxurberr);
-
- *eof = 1;
- return len;
-}
-
-
-static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return &priv->wstats;
-}
-
-void rtl8180_proc_module_init(void)
-{
- DMESG("Initializing proc filesystem");
- rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
-}
-
-
-void rtl8180_proc_module_remove(void)
-{
- remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
-}
-
-
-void rtl8180_proc_remove_one(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- if (priv->dir_dev) {
- // remove_proc_entry("stats-hw", priv->dir_dev);
- remove_proc_entry("stats-tx", priv->dir_dev);
- remove_proc_entry("stats-rx", priv->dir_dev);
- // remove_proc_entry("stats-ieee", priv->dir_dev);
- // remove_proc_entry("stats-ap", priv->dir_dev);
- remove_proc_entry("registers", priv->dir_dev);
- remove_proc_entry(dev->name, rtl8180_proc);
- priv->dir_dev = NULL;
- }
-}
-
-
-void rtl8180_proc_init_one(struct net_device *dev)
-{
- struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
- rtl8180_proc);
- if (!priv->dir_dev) {
- DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
- dev->name);
- return;
- }
- #if 0
- e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_hw, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-hw\n",
- dev->name);
- }
- #endif
- e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_rx, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-rx\n",
- dev->name);
- }
-
-
- e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_tx, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-tx\n",
- dev->name);
- }
- #if 0
- e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ieee, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-ieee\n",
- dev->name);
- }
-
-
- e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ap, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-ap\n",
- dev->name);
- }
- #endif
-
- e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_registers, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/registers\n",
- dev->name);
- }
-}
-/****************************************************************************
- -----------------------------MISC STUFF-------------------------
-*****************************************************************************/
-
-/* this is only for debugging */
-void print_buffer(u32 *buffer, int len)
-{
- int i;
- u8 *buf =(u8*)buffer;
-
- printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
- for(i=0;i<len;i++)
- printk("%c",buf[i]);
-
- printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
- for(i=0;i<len;i++)
- printk("%x",buf[i]);
-
- printk("\n");
-}
-
-short check_nic_enought_desc(struct net_device *dev, priority_t priority)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
- &priv->tx_np_pending : &priv->tx_lp_pending);
-
- return (used < MAX_TX_URB);
-}
-
-void tx_timeout(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- //rtl8180_commit(dev);
- schedule_work(&priv->reset_wq);
- //DMESG("TXTIMEOUT");
-}
-
-
-/* this is only for debug */
-void dump_eprom(struct net_device *dev)
-{
- int i;
- for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
-}
-
-/* this is only for debug */
-void rtl8180_dump_reg(struct net_device *dev)
-{
- int i;
- int n;
- int max=0xff;
-
- DMESG("Dumping NIC register map");
-
- for(n=0;n<=max;)
- {
- printk( "\nD: %2x> ", n);
- for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
- }
- printk("\n");
-}
-
-/****************************************************************************
- ------------------------------HW STUFF---------------------------
-*****************************************************************************/
-
-
-void rtl8180_irq_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- //priv->irq_enabled = 1;
-/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
- INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
- INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
-*/
- write_nic_word(dev,INTA_MASK, priv->irq_mask);
-}
-
-
-void rtl8180_irq_disable(struct net_device *dev)
-{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- write_nic_word(dev,INTA_MASK,0);
- force_pci_posting(dev);
-// priv->irq_enabled = 0;
-}
-
-
-void rtl8180_set_mode(struct net_device *dev,int mode)
-{
- u8 ecmd;
- ecmd=read_nic_byte(dev, EPROM_CMD);
- ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK;
- ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT);
- ecmd=ecmd &~ (1<<EPROM_CS_SHIFT);
- ecmd=ecmd &~ (1<<EPROM_CK_SHIFT);
- write_nic_byte(dev, EPROM_CMD, ecmd);
-}
-
-
-void rtl8180_update_msr(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- u8 msr;
-
- msr = read_nic_byte(dev, MSR);
- msr &= ~ MSR_LINK_MASK;
-
- /* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
- * this is intentional and make sense for ad-hoc and
- * master (see the create BSS/IBSS func)
- */
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
- if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
- msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
- else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
- msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
- else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
- msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
- }else
- msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
- write_nic_byte(dev, MSR, msr);
-}
-
-void rtl8180_set_chan(struct net_device *dev,short ch)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u32 tx;
- priv->chan=ch;
- #if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
- priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
- priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
- }
- #endif
-
- /* this hack should avoid frame TX during channel setting*/
- tx = read_nic_dword(dev,TX_CONF);
- tx &= ~TX_LOOPBACK_MASK;
-
-#ifndef LOOP_TEST
- write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
- priv->rf_set_chan(dev,priv->chan);
- mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
-#endif
-}
-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
-
-
-void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- int err;
-
-// u8 *rx;
-
- //DMESG("starting RX");
- /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
- DMESGE("unable to allocate RX buffer");
- return;
- }*/
-
- usb_fill_bulk_urb(rx_urb,priv->udev,
- usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
- RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
- if(err && err != -EPERM){
- DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
- }
-
-}
-
-
-void rtl8187_rx_initiate(struct net_device *dev)
-{
- int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- if(!priv->rx_urb)
- DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
- rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
-}
-
-void rtl8187_set_rxconf(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u32 rxconf;
-
- rxconf=read_nic_dword(dev,RX_CONF);
- rxconf = rxconf &~ MAC_FILTER_MASK;
- rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
-
- if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
- dev->flags & IFF_PROMISC){
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- }else{
- rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
- }
-
- /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
- }*/
-
- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
- rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
- }
-
- if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
- rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
- rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
- rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
- rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
- rxconf = rxconf &~ MAX_RX_DMA_MASK;
- rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
- rxconf = rxconf | RCR_ONLYERLPKT;
-
-// rxconf = rxconf &~ RCR_CS_MASK;
-// rxconf = rxconf | (1<<RCR_CS_SHIFT);
-
- write_nic_dword(dev, RX_CONF, rxconf);
-
- // V rtl suggested V //
-// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
- //fix_rx_fifo(dev);
-// //set_nic_rxring(dev);
- #ifdef DEBUG_RX
- DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF));
- #endif
-}
-
-void rtl8180_rx_enable(struct net_device *dev)
-{
- u8 cmd;
-
-
- rtl8187_rx_initiate(dev);
-
- rtl8187_set_rxconf(dev);
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
-#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
- */
- //mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
-#endif
-
-}
-
-
-void rtl8180_tx_enable(struct net_device *dev)
-{
- u8 cmd;
- u8 byte;
- u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- byte = read_nic_byte(dev,CW_CONF);
- byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
- byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
- write_nic_byte(dev, CW_CONF, byte);
-
- byte = read_nic_byte(dev, TX_AGC_CTL);
- byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
- byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
- byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
- write_nic_byte(dev, TX_AGC_CTL, byte);
-
- txconf= read_nic_dword(dev,TX_CONF);
-
- #if 0
- if(priv->card_8185){
-
- txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
- }else{
-
- if(priv->ieee80211->hw_seq)
- txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
- txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- }
- #endif
-
- txconf = txconf &~ TX_LOOPBACK_MASK;
-
-#ifndef LOOP_TEST
- txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
-#else
- txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
-#endif
- txconf = txconf &~ TCR_DPRETRY_MASK;
- txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
- txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
- txconf = txconf &~ TCR_MXDMA_MASK;
- txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
- txconf = txconf | TCR_CWMIN;
- txconf = txconf | TCR_DISCW;
- txconf = txconf &~ TCR_SWPLCPLEN;
-
- txconf=txconf | (1<<TX_NOICV_SHIFT);
-
- write_nic_dword(dev,TX_CONF,txconf);
-
- // V RTL suggested V //
-// write_nic_dword(dev,TX_CONF,0x00e00707);
-
-
-#ifdef DEBUG_TX
- DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
-#endif
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
-
-// mdelay(100);
- //write_nic_dword(dev,TX_CONF,txconf);
-// #endif
-/*
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev, TX_DMA_POLLING, priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- */
-}
-
-#if 0
-void rtl8180_beacon_tx_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-
-
-void rtl8180_
-_disable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-
-#endif
-
-
-void rtl8180_rtx_disable(struct net_device *dev)
-{
- u8 cmd;
- int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev, CMD, cmd &~ \
- ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
- force_pci_posting(dev);
- mdelay(10);
- if(priv->rx_urb){
- for(i=0;i<MAX_RX_URB;i++)
- usb_kill_urb(priv->rx_urb[i]);
- }
- /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
- */
-
-// if(!priv->rx_skb_complete)
-// dev_kfree_skb_any(priv->rx_skb);
-}
-
-
-int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
-{
- #if 0
- int i;
- u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
- &priv->txbeaconringdma);
- if (!priv->txbeaconring) return -1;
- for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
- /*
- *(tmp+2) = (u32)dma_tmp;
- *(tmp+3) = bufsize;
- */
- if(i+1<count)
- *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
- else
- *(tmp+4) = (u32)priv->txbeaconringdma;
-
- tmp=tmp+8;
- }
- #endif
- return 0;
-}
-
-
-void rtl8180_reset(struct net_device *dev)
-{
-
- u8 cr;
-
- /* make sure the analog power is on before
- * reset, otherwise reset may fail
- */
- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
- rtl8180_irq_disable(dev);
-
- mdelay(200);
- write_nic_byte_E(dev,0x18,0x10);
- write_nic_byte_E(dev,0x18,0x11);
- write_nic_byte_E(dev,0x18,0x00);
- mdelay(200);
-
- cr=read_nic_byte(dev,CMD);
- cr = cr & 2;
- cr = cr | (1<<CMD_RST_SHIFT);
- write_nic_byte(dev,CMD,cr);
-
- force_pci_posting(dev);
-
- mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
- DMESGW("Card reset timeout!");
- else
- DMESG("Card successfully reset");
-
- rtl8180_set_mode(dev,EPROM_CMD_LOAD);
- force_pci_posting(dev);
- mdelay(200);
-
- /* after the eeprom load cycle, make sure we have
- * correct anaparams
- */
- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
-}
-
-inline u16 ieeerate2rtlrate(int rate)
-{
- switch(rate){
- case 10:
- return 0;
- case 20:
- return 1;
- case 55:
- return 2;
- case 110:
- return 3;
- case 60:
- return 4;
- case 90:
- return 5;
- case 120:
- return 6;
- case 180:
- return 7;
- case 240:
- return 8;
- case 360:
- return 9;
- case 480:
- return 10;
- case 540:
- return 11;
- default:
- return 3;
-
- }
-}
-static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
-inline u16 rtl8180_rate2rate(short rate)
-{
- if (rate >11) return 0;
- return rtl_rate[rate];
-}
-
-
-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- priv->rxurb_task = rx_urb;
-// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
-// DMESGW("=David: Rx tasklet finish!");
-}
-
-#if 0
-void rtl8180_tx_queues_stop(struct net_device *dev)
-{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
-
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-#endif
-
-void rtl8180_data_hard_stop(struct net_device *dev)
-{
- //FIXME !!
- #if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- #endif
-}
-
-
-void rtl8180_data_hard_resume(struct net_device *dev)
-{
- // FIXME !!
- #if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- #endif
-}
-
-
-/* this function TX data frames when the ieee80211 stack requires this.
- * It checks also if we need to stop the ieee tx queue, eventually do it
- */
-void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
- unsigned long flags;
- struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
-
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
-// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
- /*
- * This function doesn't require lock because we make
- * sure it's called with the tx_lock already acquired.
- * this come from the kernel's hard_xmit callback (trought
- * the ieee stack, or from the try_wake_queue (again trought
- * the ieee stack.
- */
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
-}
-#if 0
-/* This is a rough attempt to TX a frame
- * This is called by the ieee 80211 stack to TX management frames.
- * If the ring is full packet are dropped (for data frame the queue
- * is stopped before this can happen).
- */
-int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- int ret;
- unsigned long flags;
-
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
-/*
- int i;
- for(i=0;i<skb->len;i++)
- printk("%x ", skb->data[i]);
- printk("--------------------\n");
-*/
- priv->ieee80211->stats.tx_bytes+=skb->len;
- priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
- dev_kfree_skb_any(skb);
- return ret;
-}
-#endif
-
-#if 0
-// longpre 144+48 shortpre 72+24
-u16 rtl8180_len2duration(u32 len, short rate,short* ext)
-{
- u16 duration;
- u16 drift;
- *ext=0;
-
- switch(rate){
- case 0://1mbps
- *ext=0;
- duration = ((len+4)<<4) /0x2;
- drift = ((len+4)<<4) % 0x2;
- if(drift ==0 ) break;
- duration++;
- break;
-
- case 1://2mbps
- *ext=0;
- duration = ((len+4)<<4) /0x4;
- drift = ((len+4)<<4) % 0x4;
- if(drift ==0 ) break;
- duration++;
- break;
-
- case 2: //5.5mbps
- *ext=0;
- duration = ((len+4)<<4) /0xb;
- drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
- break;
- duration++;
- break;
-
- default:
- case 3://11mbps
- *ext=0;
- duration = ((len+4)<<4) /0x16;
- drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
- break;
- duration++;
- if(drift > 6)
- break;
- *ext=1;
- break;
- }
-
- return duration;
-}
-#endif
-
-void rtl8180_try_wake_queue(struct net_device *dev, int pri);
-
-void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(tx_urb->status == 0)
- priv->stats.txlpokint++;
- else
- priv->stats.txlperr++;
- kfree(tx_urb->transfer_buffer);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_lp_pending);
- rtl8180_try_wake_queue(dev,LOW_PRIORITY);
-}
-
-
-void rtl8187_beacon_stop(struct net_device *dev)
-{
- u8 msr, msrm, msr2;
- msr = read_nic_byte(dev, MSR);
- msrm = msr & MSR_LINK_MASK;
- msr2 = msr & ~MSR_LINK_MASK;
- if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
- (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
- write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
- }
-
-
-}
-
-
-void rtl8187_net_update(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct ieee80211_network *net;
- net = & priv->ieee80211->current_network;
-
-
- write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
- write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
- //for(i=0;i<ETH_ALEN;i++)
- // write_nic_byte(dev,BSSID+i,net->bssid[i]);
-
- rtl8180_update_msr(dev);
-
-// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
- write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
- write_nic_word(dev, BcnIntTime, 100);
-
-
-}
-
-void rtl8187_beacon_tx(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct sk_buff *skb;
- int i = 0;
-
- rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
- DMESG("not enought memory for allocating beacon");
- return;
- }
-
-#if 0
- while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
- msleep_interruptible_rtl(HZ/2);
- if(i++ > 20){
- DMESG("get stuck to wait EP3 become ready");
- return ;
- }
- }
-#endif
- write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
- i=0;
- //while(!read_nic_byte(dev,BQREQ & (1<<7)))
- while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
- {
- msleep_interruptible_rtl(HZ/2);
- if(i++ > 10){
- DMESG("get stuck to wait HW beacon to be ready");
- return ;
- }
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
- 0, priv->ieee80211->basic_rate);
-
-}
-
-void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(tx_urb->status == 0)
- priv->stats.txnpokint++;
- else
- priv->stats.txnperr++;
- kfree(tx_urb->transfer_buffer);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_np_pending);
- //rtl8180_try_wake_queue(dev,NORM_PRIORITY);
-}
-
-
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
- */
-
-short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
- short morefrag, short rate)
-{
- u32 *tx;
-// u16 duration;
-// short ext;
- int pend ;
- int status;
- struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
-// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
-
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
- if( pend > MAX_TX_URB){
- if(priority == NORM_PRIORITY)
- priv->stats.txnpdrop++;
- else
- priv->stats.txlpdrop++;
- return -1;
- }
-
-
- //tx = kmalloc((len + 4*3), GFP_ATOMIC);
- urb_len = len + 4*3;
- if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
- }
- tx = kmalloc(urb_len, GFP_ATOMIC);
- if(!tx) return -ENOMEM;
-printk(KERN_WARNING "urb_len = %d\n", urb_len);
- tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
- if(!tx_urb){
-
- kfree(tx);
- return -ENOMEM;
- }
-
- memcpy(tx+3,txbuf,len);
- tx[0] = 0;
- tx[0] |= len & 0xfff;
- tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
- if(morefrag) tx[0] |= (1<<17);
- tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
- tx[0] |= (rate << 24);
- tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
-
-// tx[2] = 0x303020;
- tx[2] = 3; // CW min
- tx[2] |= (7<<4); //CW max
- tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
-// printk("%x\n%x\n",tx[0],tx[1]);
-
- #ifdef DUMP_TX
- int i;
- printk("<Tx pkt>--rate %x---",rate);
- for (i = 0; i < (len + 3); i++)
- printk("%2x", ((u8*)tx)[i]);
- printk("---------------\n");
- #endif
-
-
- /* FIXME check what EP is for low/norm PRI */
- usb_fill_bulk_urb(tx_urb,priv->udev,
- usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
- urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev);
- status = usb_submit_urb(tx_urb, GFP_ATOMIC);
- if (!status){
- atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- return 0;
- }else{
- DMESGE("Error TX URB %d, error %d",
- atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
- status);
- return -1;
- }
-}
-
-
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
-
-
-short rtl8187_usb_initendpoints(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i;
-
- priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
- for(i=0;i<MAX_RX_URB;i++){
- priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
- goto destroy;
-
- priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
- goto destroy1;
-
- priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
- }
-
- return 0;
-
-destroy1:
- usb_free_urb(priv->rx_urb[i]);
-
-destroy:
- while (--i >= 0){
- kfree(priv->rx_urb[i]->transfer_buffer);
- usb_free_urb(priv->rx_urb[i]);
- }
-
- kfree(priv->rx_urb);
-
- priv->rx_urb = NULL;
- DMESGE("Endpoint Alloc Failure");
- return -ENOMEM;
-
-}
-
-void rtl8187_usb_deleteendpoints(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i;
-
- if(priv->rx_urb){
- for(i=0;i<MAX_RX_URB;i++){
- usb_kill_urb(priv->rx_urb[i]);
- kfree(priv->rx_urb[i]->transfer_buffer);
- usb_free_urb(priv->rx_urb[i]);
- }
- kfree(priv->rx_urb);
- priv->rx_urb = NULL;
-
- }
-
-}
-
-
-void rtl8187_set_rate(struct net_device *dev)
-{
- int i;
- u16 word;
- int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
-// priv->ieee80211->state == IEEE80211_LINKED){
- basic_rate = ieeerate2rtlrate(240);
- min_rr_rate = ieeerate2rtlrate(60);
- max_rr_rate = ieeerate2rtlrate(240);
-
-//
-// }else{
-// basic_rate = ieeerate2rtlrate(20);
-// min_rr_rate = ieeerate2rtlrate(10);
-// max_rr_rate = ieeerate2rtlrate(110);
-// }
-
- write_nic_byte(dev, RESP_RATE,
- max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT);
-
- word = read_nic_word(dev, BRSR);
- word &= ~BRSR_MBR_8185;
-
-
- for(i=0;i<=basic_rate;i++)
- word |= (1<<i);
-
- write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
-}
-
-
-void rtl8187_link_change(struct net_device *dev)
-{
-// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- //write_nic_word(dev, BintrItv, net->beacon_interval);
- rtl8187_net_update(dev);
- /*update timing params*/
- rtl8180_set_chan(dev, priv->chan);
-
- rtl8187_set_rxconf(dev);
-}
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv);
-
-short rtl8180_init(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i, j;
- u16 word;
- int ch;
- //u16 version;
- //u8 hw_version;
- //u8 config3;
-
- //FIXME: these constants are placed in a bad pleace.
-
-// priv->txbuffsize = 1024;
-// priv->txringcount = 32;
-// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
-// priv->txbeaconcount = 3;
-// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
- /* ^^ the SKB does not containt a partial RXed
- * packet (is empty)
- */
-
- if(!channels){
- DMESG("No channels, aborting");
- return -1;
- }
- ch=channels;
- // set channels 1..14 allowed in given locale
- for (i=1; i<=14; i++) {
- (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
- ch >>= 1;
- }
- //memcpy(priv->stats,0,sizeof(struct Stats));
-
- //priv->irq_enabled=0;
-
-// priv->stats.rxdmafail=0;
- priv->stats.txrdu=0;
-// priv->stats.rxrdu=0;
-// priv->stats.rxnolast=0;
-// priv->stats.rxnodata=0;
- //priv->stats.rxreset=0;
- //priv->stats.rxwrkaround=0;
-// priv->stats.rxnopointer=0;
- priv->stats.txnperr=0;
- priv->stats.txresumed=0;
-// priv->stats.rxerr=0;
-// priv->stats.rxoverflow=0;
-// priv->stats.rxint=0;
- priv->stats.txnpokint=0;
- /*priv->stats.txhpokint=0;
- priv->stats.txhperr=0;*/
- priv->stats.rxurberr=0;
- priv->stats.rxstaterr=0;
- priv->stats.txoverflow=0;
- priv->stats.rxok=0;
-// priv->stats.txbeaconerr=0;
- priv->stats.txlperr=0;
- priv->stats.txlpokint=0;
-
- priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
- priv->retry_rts = DEFAULT_RETRY_RTS;
- priv->retry_data = DEFAULT_RETRY_DATA;
- priv->ieee80211->rate = 110; //11 mbps
- priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
- priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
- spin_lock_init(&priv->tx_lock);
- INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
- sema_init(&priv->wx_sem,1);
- tasklet_init(&priv->irq_rx_tasklet,
- (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
- (unsigned long)priv);
-
- //priv->ieee80211->func =
- // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
- //memset(priv->ieee80211->func, 0,
- // sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
- priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
- IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
- /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
- priv->ieee80211->active_scan = 1;
- priv->ieee80211->rate = 110; //11 mbps
- priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
- priv->ieee80211->host_encrypt = 1;
- priv->ieee80211->host_decrypt = 1;
- priv->ieee80211->start_send_beacons = rtl8187_beacon_tx;
- priv->ieee80211->stop_send_beacons = rtl8187_beacon_stop;
- //priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit;
- priv->ieee80211->softmac_hard_start_xmit = NULL;
- priv->ieee80211->set_chan = rtl8180_set_chan;
- priv->ieee80211->link_change = rtl8187_link_change;
- priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit;
- priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop;
- priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
- //priv->ieee80211->start_send_beacons = NULL;
- //priv->ieee80211->stop_send_beacons = NULL;
-
- priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
- priv->card_8185 = 2;
- priv->phy_ver = 2;
- priv->card_type = USB;
-
- #if 0
- hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
- switch (hw_version){
- case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
- priv->card_8185 = 1;
- /* you should not find a card with 8225 PHY ver < C*/
- priv->phy_ver = 2;
- break;
-
- case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
- priv->card_8185 = 2;
- /* you should not find a card with 8225 PHY ver < C*/
- priv->phy_ver = 2;
- break;
-
- case HW_VERID_R8180_ABCD:
- DMESG("MAC controller is a RTL8180");
- priv->card_8185 = 0;
- break;
-
- case HW_VERID_R8180_F:
- DMESG("MAC controller is a RTL8180 (v. F)");
- priv->card_8185 = 0;
- break;
-
- default:
- DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
- priv->card_8185 = 0;
- break;
- }
-
-
- /* you should not found any 8185 Ver B Card */
- priv->card_8185_Bversion = 0;
-
- config3 = read_nic_byte(dev, CONFIG3);
- if(config3 & 0x8){
- priv->card_type = CARDBUS;
- DMESG("This is a CARDBUS NIC");
- }
- else if( config3 & 0x4){
- priv->card_type = MINIPCI;
- DMESG("This is a MINI-PCI NIC");
- }else{
- priv->card_type = PCI;
- DMESG("This is a PCI NIC");
- }
- #endif
- priv->enable_gpio0 = 0;
-
-
- /* commented out just because we already do
- this when resetting the card
- andrea 20050924
- */
- #if 0
-
- u8 txcr, txreg50;
- u32 txreg54, txreg60;
-
- /* enable A/D D/A register */
- txcr = read_nic_byte(dev, 0x59);
-// DMESG("<txcr:%x>", txcr);
- //write_nic_word(dev, 0x59, 0x44);
- write_nic_byte(dev, 0x59, 0x44);
- //write_nic_byte(dev, 0x59, 0xea);
- txcr = read_nic_byte(dev, 0x59);
-// DMESG("<<txcr:%x>>", txcr);
-
- txreg50 = read_nic_byte(dev, 0x50);
- // DMESG("<txreg50:%x>", txreg50);
- write_nic_byte(dev, 0x50, 0xc0);
- txreg50 = read_nic_byte(dev, 0x50);
- // DMESG("<<txreg50:%x>>", txreg50);
-
-
- txreg54 = read_nic_dword(dev, 0x54);
- // DMESG("<txreg54:%x>", txreg54);
- txreg54 = 0xa0000a59;
- // DMESG("<<txreg54:%x>>", txreg54);
- write_nic_dword(dev, 0x54, txreg54);
- txreg54 = read_nic_dword(dev, 0x54);
- // DMESG("<<<txreg54:%x>>>", txreg54);
-
- txreg60 = read_nic_dword(dev, 0x60);
- // DMESG("<txreg60:%x>", txreg60);
-
- write_nic_byte(dev, 0x50, 0x0);
- txcr = read_nic_byte(dev, 0x50);
- // DMESG("<<txcr:%x>>", txcr);
-
-#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
- if (RCR_9356SEL & read_nic_dword(dev, RCR)){
- priv->epromtype=EPROM_93c56;
- DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
- }else{
- priv->epromtype=EPROM_93c46;
- DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
- }
-
- dev->get_stats = rtl8180_stats;
-
- dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
- dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
- dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
- dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
- dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
- dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
- DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
- for(i=1,j=0; i<6; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW0 + j);
- priv->chtxpwr[i]=word & 0xf;
- priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
- priv->chtxpwr[i+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
- }
-
- for(i=1,j=0; i<4; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW1 + j);
- priv->chtxpwr[i+6]=word & 0xf;
- priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
- priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
- }
-
- for(i=1,j=0; i<4; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW2 + j);
- priv->chtxpwr[i+6+4]=word & 0xf;
- priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
- priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
- }
-
-
- priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
- word = eprom_read(dev,EPROM_TXPW_BASE);
- priv->cck_txpwr_base = word & 0xf;
- priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
- /* check RF frontend chipset */
-
- switch (priv->rf_chip) {
-
- case EPROM_RFCHIPID_RTL8225U:
-
- DMESG("Card reports RF frontend Realtek 8225");
- DMESGW("This driver has EXPERIMENTAL support for this chipset.");
- DMESGW("use it with care and at your own risk and");
- DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
- if(rtl8225_is_V_z2(dev)){
- priv->rf_init = rtl8225z2_rf_init;
- priv->rf_set_chan = rtl8225z2_rf_set_chan;
- priv->rf_set_sens = NULL;
- DMESG("This seems a new V2 radio");
- }else{
- priv->rf_init = rtl8225_rf_init;
- priv->rf_set_chan = rtl8225_rf_set_chan;
- priv->rf_set_sens = rtl8225_rf_set_sens;
- DMESG("This seems a legacy 1st version radio");
- }
- priv->rf_close = rtl8225_rf_close;
-
- priv->max_sens = RTL8225_RF_MAX_SENS;
- priv->sens = RTL8225_RF_DEF_SENS;
- break;
-
- default:
- DMESGW("Unknown RF module %x",priv->rf_chip);
- DMESGW("Exiting...");
- return -1;
-
- }
-
-// DMESG("Energy threshold: %x",priv->cs_treshold);
- DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
- //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
- DMESG("Endopoints initialization failed");
- return -ENOMEM;
- }
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_NORMPRIORITY_RING_ADDR))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_HIGHPRIORITY_RING_ADDR))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_LOWPRIORITY_RING_ADDR))
- return -ENOMEM;
-
-
- if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
- return -ENOMEM;
-#endif
-
-
-#ifdef DEBUG_EPROM
- dump_eprom(dev);
-#endif
- return 0;
-
-}
-
-void rtl8185_rf_pins_enable(struct net_device *dev)
-{
-/* u16 tmp;
- tmp = read_nic_word(dev, RFPinsEnable);*/
- write_nic_word(dev, RFPinsEnable, 0x1ff7);// | tmp);
-}
-
-
-void rtl8185_set_anaparam2(struct net_device *dev, u32 a)
-{
- u8 conf3;
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- write_nic_dword(dev, ANAPARAM2, a);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
-}
-
-
-void rtl8180_set_anaparam(struct net_device *dev, u32 a)
-{
- u8 conf3;
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- write_nic_dword(dev, ANAPARAM, a);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
-}
-
-
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
-{
- write_nic_byte(dev, TX_ANTENNA, ant);
- force_pci_posting(dev);
- mdelay(1);
-}
-
-
-void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
-{
- //u8 phyr;
- u32 phyw;
-// int i;
-
- adr |= 0x80;
-
- phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
- write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
- write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
- write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
- write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
-
- //read_nic_dword(dev, PHY_ADR);
-#if 0
- for(i=0;i<10;i++){
- write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
- phyr = read_nic_byte(dev, PHY_READ);
- if(phyr == (data&0xff)) break;
-
- }
-#endif
- /* this is ok to fail when we write AGC table. check for AGC table might be
- * done by masking with 0x7f instead of 0xff
- */
- //if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data, adr);
- mdelay(1);
-}
-
-
-inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data)
-{
- data = data & 0xff;
- rtl8187_write_phy(dev, adr, data);
-}
-
-
-void write_phy_cck (struct net_device *dev, u8 adr, u32 data)
-{
- data = data & 0xff;
- rtl8187_write_phy(dev, adr, data | 0x10000);
-}
-
-
-void rtl8180_adapter_start(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- //u32 anaparam;
- //u8 config3;
-
- //rtl8180_rtx_disable(dev);
- rtl8180_reset(dev);
-
- write_nic_byte(dev,0x85,0);
- write_nic_byte(dev,0x91,0);
-
- /* light blink! */
- write_nic_byte(dev,0x85,4);
- write_nic_byte(dev,0x91,1);
- write_nic_byte(dev,0x90,0);
-
- priv->irq_mask = 0xffff;
-/*
- priv->dma_poll_mask = 0;
- priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
-// rtl8180_beacon_tx_disable(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
- write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
- write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
- rtl8180_update_msr(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- write_nic_word(dev,0xf4,0xffff);
- write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
-
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
-
-#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
-#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
-
- write_nic_byte(dev, RATE_FALLBACK, 0x81);
- rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
-
- if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
- write_nic_word(dev,0x5e,1);
-
- #if 1
- //mdelay(1);
- write_nic_word(dev,0xfe,0x10);
-// mdelay(1);
- #endif
- write_nic_byte(dev, TALLY_SEL, 0x80);//Set NQ retry count
-
- write_nic_byte(dev, 0xff, 0x60);
-
- write_nic_word(dev,0x5e,0);
-
-
- rtl8180_irq_enable(dev);
- /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
- DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
- DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
- if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
- if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
- if(check_nic_enought_desc(dev,LOW_PRIORITY)) DMESG("LOW OK");*/
-}
-
-
-
-/* this configures registers for beacon tx and enables it via
- * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might
- * be used to stop beacon transmission
- */
-#if 0
-void rtl8180_start_tx_beacon(struct net_device *dev)
-{
- int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
- DMESG("Enabling beacon TX");
- //write_nic_byte(dev, 0x42,0xe6);// TCR
- //rtl8180_init_beacon(dev);
- //set_nic_txring(dev);
-// rtl8180_prepare_beacon(dev);
- rtl8180_irq_disable(dev);
-// rtl8180_beacon_tx_enable(dev);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- //write_nic_byte(dev,0x9d,0x20); //DMA Poll
- //write_nic_word(dev,0x7a,0);
- //write_nic_word(dev,0x7a,0x8000);
-
-
- word = read_nic_word(dev, BcnItv);
- word &= ~BcnItv_BcnItv; // clear Bcn_Itv
- write_nic_word(dev, BcnItv, word);
-
- write_nic_word(dev, AtimWnd,
- read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
- word = read_nic_word(dev, BintrItv);
- word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
- // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
- // FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
- write_nic_word(dev, BintrItv, word);
-
- //write_nic_word(dev,0x2e,0xe002);
- //write_nic_dword(dev,0x30,0xb8c7832e);
- for(i=0; i<ETH_ALEN; i++)
- write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
-// rtl8180_update_msr(dev);
-
-
- //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
- rtl8180_irq_enable(dev);
-
- /* VV !!!!!!!!!! VV*/
- /*
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-*/
-}
-#endif
-/***************************************************************************
- -------------------------------NET STUFF---------------------------
-***************************************************************************/
-static struct net_device_stats *rtl8180_stats(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return &priv->ieee80211->stats;
-}
-
-
-int _rtl8180_up(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- priv->up=1;
-
- //DMESG("Bringing up iface");
-
- rtl8180_adapter_start(dev);
-
- rtl8180_rx_enable(dev);
-
- rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
- if(!netif_queue_stopped(dev))
- netif_start_queue(dev);
- else
- netif_wake_queue(dev);
-
- return 0;
-}
-
-
-int rtl8180_open(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
- down(&priv->wx_sem);
- ret = rtl8180_up(dev);
- up(&priv->wx_sem);
- return ret;
-
-}
-
-
-int rtl8180_up(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 1) return -1;
-
- return _rtl8180_up(dev);
-}
-
-
-int rtl8180_close(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
- down(&priv->wx_sem);
-
- ret = rtl8180_down(dev);
-
- up(&priv->wx_sem);
-
- return ret;
-
-}
-
-int rtl8180_down(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 0) return -1;
-
- priv->up=0;
-
-/* FIXME */
- if (!netif_queue_stopped(dev))
- netif_stop_queue(dev);
-
- rtl8180_rtx_disable(dev);
- rtl8180_irq_disable(dev);
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
- return 0;
-}
-
-
-void rtl8180_commit(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
- rtl8180_irq_disable(dev);
- rtl8180_rtx_disable(dev);
- _rtl8180_up(dev);
-}
-
-void rtl8180_restart(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- down(&priv->wx_sem);
-
- rtl8180_commit(dev);
-
- up(&priv->wx_sem);
-}
-
-static void r8180_set_multicast(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- short promisc;
-
- //down(&priv->wx_sem);
-
- /* FIXME FIXME */
-
- promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
- if (promisc != priv->promisc)
- // rtl8180_commit(dev);
-
- priv->promisc = promisc;
-
- //schedule_work(&priv->reset_wq);
- //up(&priv->wx_sem);
-}
-
-
-int r8180_set_mac_adr(struct net_device *dev, void *mac)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct sockaddr *addr = mac;
-
- down(&priv->wx_sem);
-
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
- schedule_work(&priv->reset_wq);
-
- up(&priv->wx_sem);
-
- return 0;
-}
-
-
-/* based on ipw2200 driver */
-int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
- switch (cmd) {
- case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
- break;
-
- default:
- ret = -EOPNOTSUPP;
- break;
- }
-
- up(&priv->wx_sem);
-
- return ret;
-}
-
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv)
-{
- struct urb *rx_urb = priv->rxurb_task;
- struct net_device *dev = (struct net_device*)rx_urb->context;
- int status,len,flen;
- struct sk_buff *skb;
- u32 *desc;
-
- //DMESG("rtl8187_rx_isr");
-
- struct ieee80211_rx_stats stats = {
- .signal = 0,
- .noise = -98,
- .rate = 0,
- // .mac_time = jiffies,
- .freq = IEEE80211_24GHZ_BAND,
- };
-
- //DMESG("RX %d ",rx_urb->status);
- status = rx_urb->status;
- if(status == 0){
-
- len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
- len -= 4*4;/* 4 dword and 4 byte CRC */
-
- desc = (u32*)(rx_urb->transfer_buffer + len);
-
- flen = desc[0] & 0xfff;
-
- if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
- stats.mac_time[0] = desc[2];
- stats.mac_time[1] = desc[3];
- skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
- memcpy(skb_put(skb,flen-4),
- rx_urb->transfer_buffer,flen -4);
-
- #ifdef DUMP_RX
- int i;
- for(i=0;i<flen-4;i++)
- printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
- printk("------RATE %x:w---------------\n",stats.rate);
-
- #endif
- priv->stats.rxok++;
- // priv->rxskb = skb;
- // priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
- skb, &stats))
- dev_kfree_skb_any(skb);
- }
- }else priv->stats.rxurberr++;
- }else{
- priv->stats.rxstaterr++;
- priv->ieee80211->stats.rx_errors++;
-
- }
-
- if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
- else DMESG("RX process aborted due to explicit shutdown");
-}
-
-/****************************************************************************
- ---------------------------- USB_STUFF---------------------------
-*****************************************************************************/
-
-
-static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
-{
-// unsigned long ioaddr = 0;
- struct net_device *dev = NULL;
- struct r8180_priv *priv= NULL;
- struct usb_device *udev = interface_to_usbdev(intf);
-
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
- SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
- SET_NETDEV_DEV(dev, &intf->dev);
-
- priv = ieee80211_priv(dev);
- priv->ieee80211 = netdev_priv(dev);
-
- priv->udev=udev;
-
- dev->open = rtl8180_open;
- dev->stop = rtl8180_close;
- //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
- dev->tx_timeout = tx_timeout;
- dev->wireless_handlers = &r8180_wx_handlers_def;
- dev->do_ioctl = rtl8180_ioctl;
- dev->set_multicast_list = r8180_set_multicast;
- dev->set_mac_address = r8180_set_mac_adr;
- dev->get_wireless_stats = r8180_get_wireless_stats;
- dev->type=ARPHRD_ETHER;
-
- if (dev_alloc_name(dev, ifname) < 0){
- DMESG("Oops: devname already taken! Trying wlan%%d...\n");
- ifname = "wlan%d";
- dev_alloc_name(dev, ifname);
- }
-
-// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
- DMESG("Initialization failed");
- goto fail;
- }
-
- netif_carrier_off(dev);
- netif_stop_queue(dev);
-
- register_netdev(dev);
-
- rtl8180_proc_init_one(dev);
-
-
- DMESG("Driver probe completed\n");
- return 0;
-
-
-fail:
- free_ieee80211(dev);
-
- DMESG("wlan driver load failed\n");
-
- return -ENODEV;
-
-}
-
-
-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf)
-{
- struct r8180_priv *priv;
- struct net_device *dev = usb_get_intfdata(intf);
- if(dev){
-
- unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
- rtl8180_proc_remove_one(dev);
-
- rtl8180_down(dev);
- priv->rf_close(dev);
- //rtl8180_rtx_disable(dev);
- rtl8187_usb_deleteendpoints(dev);
- rtl8180_irq_disable(dev);
- rtl8180_reset(dev);
- mdelay(10);
-
- }
-// pci_disable_device(pdev);
- free_ieee80211(dev);
- DMESG("wlan driver removed\n");
-}
-
-
-static int __init rtl8187_usb_module_init(void)
-{
- printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
-based WLAN cards\n");
- printk(KERN_INFO "Copyright (c) 2004-2005, Andrea Merello\n");
- DMESG("Initializing module");
- DMESG("Wireless extensions version %d", WIRELESS_EXT);
- rtl8180_proc_module_init();
- return usb_register(&rtl8187_usb_driver);
-}
-
-
-static void __exit rtl8187_usb_module_exit(void)
-{
- usb_deregister(&rtl8187_usb_driver);
-
- rtl8180_proc_module_remove();
- DMESG("Exiting");
-}
-
-
-void rtl8180_try_wake_queue(struct net_device *dev, int pri)
-{
- unsigned long flags;
- short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- spin_lock_irqsave(&priv->tx_lock,flags);
- enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
- if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
-}
-
-
-
-/***************************************************************************
- ------------------- module init / exit stubs ----------------
-****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2006-06-05 23:48:10.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187.h 2010-05-19 22:23:52.586008695 -0700
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -44,8 +43,16 @@
#include <linux/if_arp.h>
#include <linux/random.h>
#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
#include <asm/io.h>
#include <asm/semaphore.h>
+#include <linux/config.h>
+#else
+#include <linux/io.h>
+#include <linux/semaphore.h>
+//#include <linux/autoconf.h>
+#endif
#include "ieee80211.h"
@@ -68,7 +75,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +130,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +150,18 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+ short highpower;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +170,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +183,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +237,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +251,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187.h~
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ 2006-06-05 19:58:02.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/r8187.h~ 1969-12-31 16:00:00.000000000 -0800
@@ -1,288 +0,0 @@
-/*
- This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
- Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
- official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
- from Patric Schenke & Andres Salomon
-
- Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
- project Authors.
-*/
-
-#ifndef R8180H
-#define R8180H
-
-
-#define RTL8187_MODULE_NAME "rtl8187"
-#define DMESG(x,a...) printk(KERN_INFO RTL8187_MODULE_NAME ": " x "\n", ## a)
-#define DMESGW(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": WW:" x "\n", ## a)
-#define DMESGE(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": EE:" x "\n", ## a)
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/netdevice.h>
-//#include <linux/pci.h>
-#include <linux/usb.h>
-#include <linux/etherdevice.h>
-#include <linux/delay.h>
-#include <linux/rtnetlink.h> //for rtnl_lock()
-#include <linux/wireless.h>
-#include <linux/timer.h>
-#include <linux/proc_fs.h> // Necessary because we use the proc fs
-#include <linux/if_arp.h>
-#include <linux/random.h>
-#include <linux/version.h>
-#include <asm/io.h>
-#include <asm/semaphore.h>
-
-#include "ieee80211.h"
-
-#define EPROM_93c46 0
-#define EPROM_93c56 1
-
-#define DEFAULT_FRAG_THRESHOLD 2342U
-#define MIN_FRAG_THRESHOLD 256U
-#define DEFAULT_BEACONINTERVAL 0x64U
-#define DEFAULT_BEACON_ESSID "Rtl8187"
-
-#define DEFAULT_SSID ""
-#define DEFAULT_RETRY_RTS 7
-#define DEFAULT_RETRY_DATA 7
-#define PRISM_HDR_SIZE 64
-
-#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30
-
-typedef struct buffer
-{
- struct buffer *next;
- u32 *buf;
-
-} buffer;
-
-#if 0
-
-typedef struct tx_pendingbuf
-{
- struct ieee80211_txb *txb;
- short ispending;
- short descfrag;
-} tx_pendigbuf;
-
-#endif
-
-typedef struct Stats
-{
- unsigned long txrdu;
-// unsigned long rxrdu;
- //unsigned long rxnolast;
- //unsigned long rxnodata;
-// unsigned long rxreset;
-// unsigned long rxwrkaround;
-// unsigned long rxnopointer;
- unsigned long rxok;
- unsigned long rxurberr;
- unsigned long rxstaterr;
- unsigned long txnperr;
- unsigned long txnpdrop;
- unsigned long txresumed;
-// unsigned long rxerr;
-// unsigned long rxoverflow;
-// unsigned long rxint;
- unsigned long txnpokint;
-// unsigned long txhpokint;
-// unsigned long txhperr;
-// unsigned long ints;
-// unsigned long shints;
- unsigned long txoverflow;
-// unsigned long rxdmafail;
-// unsigned long txbeacon;
-// unsigned long txbeaconerr;
- unsigned long txlpokint;
- unsigned long txlpdrop;
- unsigned long txlperr;
- unsigned long txdatapkt;
-} Stats;
-
-
-
-typedef struct r8180_priv
-{
- struct usb_device *udev;
- short epromtype;
- int irq;
- struct ieee80211_device *ieee80211;
-
- short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
- short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
- short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
- short enable_gpio0;
- enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
- short hw_plcp_len;
-
-// spinlock_t irq_lock;
-// spinlock_t irq_th_lock;
- spinlock_t tx_lock;
-
- u16 irq_mask;
-// short irq_enabled;
- struct net_device *dev;
- short chan;
- short sens;
- short max_sens;
- u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
- u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
- u8 cck_txpwr_base;
- u8 ofdm_txpwr_base;
- u8 challow[15]; //channels from 1 to 14, 0 not used
- short up;
- short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
-// struct timer_list scan_timer;
- /*short scanpending;
- short stopscan;*/
-// spinlock_t scan_lock;
-// u8 active_probe;
- //u8 active_scan_num;
- struct semaphore wx_sem;
-// short hw_wep;
-
-// short digphy;
-// short antb;
-// short diversity;
-// u8 cs_treshold;
-// short rcr_csense;
- short rf_chip;
-// u32 key0[4];
- short (*rf_set_sens)(struct net_device *dev,short sens);
- void (*rf_set_chan)(struct net_device *dev,short ch);
- void (*rf_close)(struct net_device *dev);
- void (*rf_init)(struct net_device *dev);
- //short rate;
- short promisc;
- /*stats*/
- struct Stats stats;
- struct iw_statistics wstats;
- struct proc_dir_entry *dir_dev;
-
- /*RX stuff*/
-// u32 *rxring;
-// u32 *rxringtail;
-// dma_addr_t rxringdma;
- struct urb **rx_urb;
-
- //struct buffer *rxbuffer;
- //struct buffer *rxbufferhead;
- //int rxringcount;
- //u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
-
- //short rx_skb_complete;
-
- //u32 rx_prevlen;
- atomic_t tx_lp_pending;
- atomic_t tx_np_pending;
-#if 0
- /*TX stuff*/
- u32 *txlpring;
- u32 *txhpring;
- u32 *txnpring;
- dma_addr_t txlpringdma;
- dma_addr_t txhpringdma;
- dma_addr_t txnpringdma;
- u32 *txlpringtail;
- u32 *txhpringtail;
- u32 *txnpringtail;
- u32 *txlpringhead;
- u32 *txhpringhead;
- u32 *txnpringhead;
- struct buffer *txlpbufs;
- struct buffer *txhpbufs;
- struct buffer *txnpbufs;
- struct buffer *txlpbufstail;
- struct buffer *txhpbufstail;
- struct buffer *txnpbufstail;
- int txringcount;
- int txbuffsize;
-
- //struct tx_pendingbuf txnp_pending;
- struct tasklet_struct irq_tx_tasklet;
-#endif
-// struct tasklet_struct irq_rx_tasklet;
-// u8 dma_poll_mask;
- //short tx_suspend;
-
- /* adhoc/master mode stuff */
-#if 0
- u32 *txbeacontail;
- dma_addr_t txbeaconringdma;
- u32 *txbeaconring;
- int txbeaconcount;
-#endif
-// struct ieee_tx_beacon *beacon_buf;
- //char *master_essid;
-// dma_addr_t beacondmabuf;
- //u16 master_beaconinterval;
-// u32 master_beaconsize;
- //u16 beacon_interval;
-
- u8 retry_data;
- u8 retry_rts;
-
- struct work_struct reset_wq;
-
-}r8180_priv;
-
-
-typedef enum{
- LOW_PRIORITY ,
- NORM_PRIORITY
- } priority_t;
-
-
-short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
-
-u8 read_nic_byte(struct net_device *dev, int x);
-u8 read_nic_byte_E(struct net_device *dev, int x);
-u32 read_nic_dword(struct net_device *dev, int x);
-u16 read_nic_word(struct net_device *dev, int x) ;
-void write_nic_byte(struct net_device *dev, int x,u8 y);
-void write_nic_byte_E(struct net_device *dev, int x,u8 y);
-void write_nic_word(struct net_device *dev, int x,u16 y);
-void write_nic_dword(struct net_device *dev, int x,u32 y);
-void force_pci_posting(struct net_device *dev);
-
-void rtl8180_rtx_disable(struct net_device *);
-void rtl8180_rx_enable(struct net_device *);
-void rtl8180_tx_enable(struct net_device *);
-
-void rtl8180_disassociate(struct net_device *dev);
-//void fix_rx_fifo(struct net_device *dev);
-void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a);
-
-void rtl8180_set_anaparam(struct net_device *dev,u32 a);
-void rtl8185_set_anaparam2(struct net_device *dev,u32 a);
-void rtl8180_update_msr(struct net_device *dev);
-int rtl8180_down(struct net_device *dev);
-int rtl8180_up(struct net_device *dev);
-void rtl8180_commit(struct net_device *dev);
-void rtl8180_set_chan(struct net_device *dev,short ch);
-void write_phy(struct net_device *dev, u8 adr, u8 data);
-void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
-void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
-void rtl8187_set_rxconf(struct net_device *dev);
-#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod rtl8187_linux_26.1010.0622.2006.modified/beta-8187/.tmp_versions/r8187.mod
--- rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod 2006-06-21 22:40:15.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/beta-8187/.tmp_versions/r8187.mod 2010-05-19 22:24:09.366013373 -0700
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187.ko
-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187_core.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_93cx6.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_wx.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225z2.o
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.ko
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c 2006-06-05 19:57:56.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt.c 2010-05-19 22:22:30.982698060 -0700
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+//#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c 2006-06-05 19:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_ccmp.c 2010-05-19 22:22:46.906050739 -0700
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+//#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h 2006-06-05 19:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt.h 2010-05-19 22:18:51.936032580 -0700
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_tkip.c 2010-05-19 22:23:00.716049971 -0700
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+//#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,23 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 2, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +416,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +428,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +476,30 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,33 +533,59 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[0].page = virt_to_page(hdr);
sg[0].offset = offset_in_page(hdr);
sg[0].length = 16;
+#else
+ sg_set_page(&sg[0], virt_to_page(hdr), 16, offset_in_page(hdr));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[1].page = virt_to_page(data);
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#else
+ sg_set_page(&sg[1], virt_to_page(data), data_len, offset_in_page(data));
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +615,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +627,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +665,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +681,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +689,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +698,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +716,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +732,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +777,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +807,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +834,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_crypt_wep.c 2010-05-19 22:23:15.121856118 -0700
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+//#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,25 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +214,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +244,26 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +284,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +298,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +311,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +320,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h 2006-06-05 19:57:56.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211.h 2010-05-19 22:18:51.949360395 -0700
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,21 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-
-extern inline void *ieee80211_priv(struct net_device *dev)
+#if WIRELESS_EXT >= 22
+static inline void *ieee80211_priv_rtl7(struct net_device *dev)
+#else
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
+#endif
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1200,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1226,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1254,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1401,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1419,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_module.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2006-06-05 19:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_module.c 2010-05-19 22:22:09.069343493 -0700
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+//#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -112,18 +117,22 @@
IEEE80211_ERROR("Unable to network device.\n");
goto failed;
}
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+#else
+ ieee = (struct ieee80211_device *)dev->priv;
+#endif
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +147,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +158,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +176,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +184,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +200,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +219,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +252,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +277,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +291,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_rx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2006-06-05 19:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_rx.c 2010-05-19 22:21:30.641869318 -0700
@@ -13,16 +13,15 @@
* more details.
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
-
+
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,94 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+//#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+
+ hdr->mactime.did = LWNG_CAP_DID_BASE | (2 << 12);
+ hdr->mactime.status = 0;
+ hdr->mactime.len = 4;
+ hdr->mactime.data = rx_stats->mac_time[0];
+
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+#else
+ skb_reset_mac_header(skb);
+#endif
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +139,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +169,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +208,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +221,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +231,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +253,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,13 +262,13 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
-
+
return 0;
-
+
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
@@ -253,7 +328,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +369,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +379,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +414,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +424,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +442,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -413,7 +488,7 @@
last_seq = &ieee->last_seq_num;
last_frag = &ieee->last_frag_num;
last_time = &ieee->last_packet_time;
-
+
break;
default:
return 0;
@@ -436,7 +511,7 @@
drop:
// BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
// printk("DUP\n");
-
+
return 1;
}
@@ -444,7 +519,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -481,9 +556,9 @@
type = WLAN_FC_GET_TYPE(fc);
stype = WLAN_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctl);
-
+
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +576,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +604,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +630,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -573,9 +648,9 @@
goto rx_dropped;
}
#endif
-
-
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+
+
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -583,7 +658,7 @@
/* Data frame - extract src/dst addresses */
-
+
switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN);
@@ -606,7 +681,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +694,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +705,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +739,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +749,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +769,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +797,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +838,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -861,7 +936,12 @@
if (skb2 != NULL) {
/* send to wireless media */
skb2->protocol = __constant_htons(ETH_P_802_3);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb2->mac.raw = skb2->nh.raw = skb2->data;
+#else
+ skb_reset_mac_header(skb2);
+ skb_reset_network_header(skb2);
+#endif
/* skb2->nh.raw = skb2->data + ETH_HLEN; */
skb2->dev = dev;
dev_queue_xmit(skb2);
@@ -896,7 +976,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +993,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1044,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1071,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1094,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1043,47 +1123,47 @@
break;
case MFIE_TYPE_TIM:
-
- if(info_element->len < 4)
+
+ if(info_element->len < 4)
break;
-
+
network->dtim_period = info_element->data[1];
-
+
if(ieee->state != IEEE80211_LINKED)
break;
-
- network->last_dtim_sta_time[0] = stats->mac_time[0];
+
+ network->last_dtim_sta_time[0] = stats->mac_time[0];
network->last_dtim_sta_time[1] = stats->mac_time[1];
-
+
network->dtim_data = IEEE80211_DTIM_VALID;
-
- if(info_element->data[0] != 0)
+
+ if(info_element->data[0] != 0)
break;
-
+
if(info_element->data[2] & 1)
network->dtim_data |= IEEE80211_DTIM_MBCAST;
-
+
offset = (info_element->data[2] >> 1)*2;
-
- //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
-
- if(ieee->assoc_id < offset ||
+
+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
+
+ if(ieee->assoc_id < offset ||
ieee->assoc_id > 8*(offset + info_element->len -3))
-
+
break;
-
-
+
+
offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ;
-
- // printk("offset:%x data:%x, ucast:%d\n", offset,
+
+ // printk("offset:%x data:%x, ucast:%d\n", offset,
// info_element->data[3+offset] ,
// info_element->data[3+offset] & (1<<(ieee->assoc_id%8)));
-
+
if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
network->dtim_data |= IEEE80211_DTIM_UCAST;
-
+
break;
-
+
case MFIE_TYPE_IBSS_SET:
IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n");
break;
@@ -1115,7 +1195,7 @@
memcpy(network->rsn_ie, info_element,
network->rsn_ie_len);
break;
-
+
default:
IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
info_element->id);
@@ -1147,7 +1227,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,24 +1235,24 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
- * and the capability field (in particular IBSS and BSS) all match.
+ * and the capability field (in particular IBSS and BSS) all match.
* We treat all <hidden> with the same BSSID and channel
* as one network */
return ((src->ssid_len == dst->ssid_len) &&
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
- ((src->capability & WLAN_CAPABILITY_IBSS) ==
+ ((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
- ((src->capability & WLAN_CAPABILITY_BSS) ==
+ ((src->capability & WLAN_CAPABILITY_BSS) ==
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1194,7 +1274,7 @@
dst->dtim_data = src->dtim_data;
dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
-
+
memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len);
dst->wpa_ie_len = src->wpa_ie_len;
memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
@@ -1204,7 +1284,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1319,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1261,12 +1341,12 @@
* already there. */
spin_lock_irqsave(&ieee->lock, flags);
-
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
-
+
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
+
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1386,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1315,39 +1395,39 @@
WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
-
+
/* we have an entry and we are going to update it. But this entry may
- * be already expired. In this case we do the same as we found a new
+ * be already expired. In this case we do the same as we found a new
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_BEACON:
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
-
+
case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1435,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_softmac.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c 2006-06-18 18:27:33.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_softmac.c 2010-05-19 22:18:51.969358999 -0700
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,211 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
+ if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE);
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,166 +882,181 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1067,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1092,19 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
- printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+ printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10));
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1087,44 +1112,45 @@
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1158,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1218,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1311,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1338,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1477,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1488,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1631,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1656,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1670,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1687,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1717,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1739,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1767,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1790,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
{
-
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1887,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1918,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
- ieee->rate = 540;
+
+// ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
- ieee->rate = 110;
+// ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1963,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1973,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2025,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
+
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2149,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2181,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2258,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2279,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2291,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2315,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2348,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2399,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2416,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2455,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2469,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2490,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2573,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2585,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2600,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2629,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2645,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_softmac_wx.c 2010-05-19 22:18:51.972696243 -0700
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_tx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_tx.c 2010-05-19 22:21:50.072722993 -0700
@@ -24,15 +24,14 @@
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+//#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -299,27 +304,27 @@
}
if(likely(ieee->raw_tx == 0)){
-
+
if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
-
+
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-
+
crypt = ieee->crypt[ieee->tx_keyidx];
-
+
encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
ieee->host_encrypt && crypt && crypt->ops;
-
+
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
stats->tx_dropped++;
goto success;
}
-
+
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !encrypt && ether_type == ETH_P_PAE) {
struct eapol *eap = (struct eapol *)(skb->data +
@@ -328,23 +333,23 @@
eap_get_type(eap->type));
}
#endif
-
+
/* Save source and destination addresses */
memcpy(&dest, skb->data, ETH_ALEN);
memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
-
+
/* Advance the SKB to the start of the payload */
skb_pull(skb, sizeof(struct ethhdr));
-
+
/* Determine total amount of storage required for TXB packets */
bytes = skb->len + SNAP_SIZE + sizeof(u16);
-
+
if (encrypt)
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_WEP;
else
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
-
+
if (ieee->iw_mode == IW_MODE_INFRA) {
fc |= IEEE80211_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -360,9 +365,9 @@
memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
}
header.frame_ctl = cpu_to_le16(fc);
-
+
hdr_len = IEEE80211_3ADDR_LEN;
-
+
/* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */
if (is_multicast_ether_addr(dest) ||
@@ -370,7 +375,7 @@
frag_size = MAX_FRAG_THRESHOLD;
else
frag_size = ieee->fts;
-
+
/* Determine amount of payload per fragment. Regardless of if
* this stack is providing the full 802.11 header, one will
* eventually be affixed to this fragment -- so we must account for
@@ -379,12 +384,12 @@
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
bytes_per_frag -= IEEE80211_FCS_LEN;
-
+
/* Each fragment may need to have room for encryptiong pre/postfix */
if (encrypt)
bytes_per_frag -= crypt->ops->extra_prefix_len +
crypt->ops->extra_postfix_len;
-
+
/* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */
nr_frags = bytes / bytes_per_frag;
@@ -393,11 +398,11 @@
nr_frags++;
else
bytes_last_frag = bytes_per_frag;
-
+
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -405,93 +410,94 @@
}
txb->encrypted = encrypt;
txb->payload_size = bytes;
-
+
for (i = 0; i < nr_frags; i++) {
skb_frag = txb->fragments[i];
-
+
if (encrypt)
skb_reserve(skb_frag, crypt->ops->extra_prefix_len);
-
+
frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len);
memcpy(frag_hdr, &header, hdr_len);
-
+
/* If this is not the last fragment, then add the MOREFRAGS
* bit to the frame control */
if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16(
fc | IEEE80211_FCTL_MOREFRAGS);
bytes = bytes_per_frag;
-
+
} else {
/* The last fragment takes the remaining length */
bytes = bytes_last_frag;
}
-
+
frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i);
-
-
+
+
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
}
-
+
memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
-
+
/* Advance the SKB... */
skb_pull(skb, bytes);
-
+
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
}
- // Advance sequence number in data frame.
+ // Advance sequence number in data frame.
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
- }
+ }
success:
spin_unlock_irqrestore(&ieee->lock, flags);
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
-
-
+
+
}
return 0;
@@ -504,4 +510,5 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
+EXPORT_SYMBOL(ieee80211_xmit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_wx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c 2006-06-05 19:57:56.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/ieee80211_wx.c 2010-05-19 22:18:51.982705602 -0700
@@ -40,8 +40,9 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
- char *start, char *stop,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
+ char *start, char *stop,
struct ieee80211_network *network)
{
char custom[MAX_CUSTOM_LEN];
@@ -54,7 +55,11 @@
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN);
+#endif
/* Remaining entries will be displayed in the order we provide them */
@@ -63,16 +68,28 @@
iwe.u.data.flags = 1;
if (network->flags & NETWORK_EMPTY_ESSID) {
iwe.u.data.length = sizeof("<hidden>");
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>");
+#else
start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
+#endif
} else {
iwe.u.data.length = min(network->ssid_len, (u8)32);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
+#else
start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
+#endif
}
/* Add the protocol name */
iwe.cmd = SIOCGIWNAME;
snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN);
+#endif
/* Add mode */
iwe.cmd = SIOCGIWMODE;
@@ -83,8 +100,13 @@
else
iwe.u.mode = IW_MODE_ADHOC;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe,
+ IW_EV_UINT_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe,
IW_EV_UINT_LEN);
+#endif
}
/* Add frequency/channel */
@@ -94,7 +116,11 @@
iwe.u.freq.m = network->channel;
iwe.u.freq.e = 0;
iwe.u.freq.i = 0;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN);
+#endif
/* Add encryption capability */
iwe.cmd = SIOCGIWENCODE;
@@ -103,7 +129,11 @@
else
iwe.u.data.flags = IW_ENCODE_DISABLED;
iwe.u.data.length = 0;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
+#else
start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
+#endif
/* Add basic and extended rates */
max_rate = 0;
@@ -132,13 +162,22 @@
iwe.cmd = SIOCGIWRATE;
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
iwe.u.bitrate.value = max_rate * 500000;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe,
+ IW_EV_PARAM_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe,
IW_EV_PARAM_LEN);
+#endif
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+#else
start = iwe_stream_add_point(start, stop, &iwe, custom);
+#endif
/* Add quality statistics */
/* TODO: Fix these values... */
@@ -154,14 +193,22 @@
if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL))
iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN);
+#else
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);
+#endif
iwe.cmd = IWEVCUSTOM;
p = custom;
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+#else
start = iwe_stream_add_point(start, stop, &iwe, custom);
+#endif
if (ieee->wpa_enabled && network->wpa_ie_len){
char buf[MAX_WPA_IE_LEN * 2 + 30];
@@ -175,7 +222,12 @@
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = strlen(buf);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, buf);
+#else
start = iwe_stream_add_point(start, stop, &iwe, buf);
+#endif
+
}
if (ieee->wpa_enabled && network->rsn_ie_len){
@@ -190,7 +242,11 @@
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = strlen(buf);
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, buf);
+#else
start = iwe_stream_add_point(start, stop, &iwe, buf);
+#endif
}
/* Add EXTRA: Age to display seconds since last beacon/probe response
@@ -201,13 +257,17 @@
" Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100));
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
+#if WIRELESS_EXT >= 22
+ start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+#else
start = iwe_stream_add_point(start, stop, &iwe, custom);
+#endif
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +280,15 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, info, ev,
+stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +309,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -259,6 +321,9 @@
int i, key, key_provided, len;
struct ieee80211_crypt_data **crypt;
+ if (erq->flags & IW_ENCODE_RESTRICTED)
+ return -EINVAL;
+
IEEE80211_DEBUG_WX("SET_ENCODE\n");
key = erq->flags & IW_ENCODE_INDEX;
@@ -281,7 +346,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +356,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +379,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +391,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +405,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +483,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +495,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +535,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Makefile
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Makefile 2010-05-19 22:18:51.986075533 -0700
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/modules.order rtl8187_linux_26.1010.0622.2006.modified/ieee80211/modules.order
--- rtl8187_linux_26.1010.0622.2006/ieee80211/modules.order 1969-12-31 16:00:00.000000000 -0800
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/modules.order 2010-05-19 22:23:55.968503440 -0700
@@ -0,0 +1,5 @@
+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl.ko
+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl.ko
+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep-rtl.ko
+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip-rtl.ko
+kernel//home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp-rtl.ko
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Modules.symvers
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers 2006-06-05 19:57:56.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Modules.symvers 1969-12-31 16:00:00.000000000 -0800
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Module.symvers rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Module.symvers
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Module.symvers 1969-12-31 16:00:00.000000000 -0800
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/Module.symvers 2010-05-19 22:24:10.342666003 -0700
@@ -0,0 +1,41 @@
+0x00000000 ieee80211_softmac_start_protocol_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 free_ieee80211_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_name_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_mode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_mode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_rate_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_rate_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_scan_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_scan_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_freq_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_freq_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_register_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_ps_tx_ack_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_rx_mgt_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_unregister_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_essid_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_essid_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_stop_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_rx_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_crypt_deinit_handler_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_wap_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_wap_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wlan_frequencies_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_get_crypto_ops_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_xmit_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_power_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_power_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_crypt_deinit_entries_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_is_54g_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_get_beacon_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_is_shortslot_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_rawtx_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_reset_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_softmac_stop_protocol_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wpa_supplicant_ioctl_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 alloc_ieee80211_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_txb_free_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wake_queue_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_crypt_delayed_deinit_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_get_encode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
+0x00000000 ieee80211_wx_set_encode_rtl7 /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl EXPORT_SYMBOL
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2010-05-19 22:23:55.941849065 -0700
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp.o
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp-rtl.ko
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2010-05-19 22:23:55.861848365 -0700
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt.o
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt-rtl.ko
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2010-05-19 22:23:55.921850950 -0700
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip.o
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip-rtl.ko
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2010-05-19 22:23:55.888502601 -0700
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep.o
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep-rtl.ko
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod 2006-06-05 19:57:54.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ieee80211/.tmp_versions/ieee80211-rtl.mod 2010-05-19 22:23:55.841835305 -0700
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_rx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_tx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_wx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_module.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac_wx.o
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211-rtl.ko
+/home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.o /home/dsk/repos/rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.o
diff -Naur rtl8187_linux_26.1010.0622.2006/makedrv~ rtl8187_linux_26.1010.0622.2006.modified/makedrv~
--- rtl8187_linux_26.1010.0622.2006/makedrv~ 2006-09-05 07:21:10.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/makedrv~ 1969-12-31 16:00:00.000000000 -0800
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-#tar -zxvf stack.tar.gz
-#tar -zxvf drv.tar.gz
-cd ieee80211
-make clean
-make
-cd ../beta-8187
-make clean
-make
-cd ..
-
-
diff -Naur rtl8187_linux_26.1010.0622.2006/Makefile rtl8187_linux_26.1010.0622.2006.modified/Makefile
--- rtl8187_linux_26.1010.0622.2006/Makefile 1969-12-31 16:00:00.000000000 -0800
+++ rtl8187_linux_26.1010.0622.2006.modified/Makefile 2010-05-19 22:18:52.002707069 -0700
@@ -0,0 +1,38 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ rtl8187_linux_26.1010.0622.2006.modified/ReadMe.txt~
--- rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ 2006-06-06 10:58:00.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/ReadMe.txt~ 1969-12-31 16:00:00.000000000 -0800
@@ -1,129 +0,0 @@
-Release Date: 2006-01-13, ver 1.1
-RTL8187 Linux driver version 1.1
-
- --This driver supports RealTek RTL8187 Wireless LAN driver for
- Fedora Core 2/3/4/5, Debian 3.1, Mandrake 10.2/Mandriva 2006,
- SUSE 9.3/10.1/10.2, Gentoo 3.1, etc.
- - Support Client mode for either infrastructure or adhoc mode
- - Support WEP and WPAPSK connection
-
-< Component >
-The driver is composed of several parts:
- 1. Module source code
- stack.tar.gz
- drv.tar.gz
-
- 2. Script ot build the modules
- makedrv
-
- 3. Script to load/unload modules
- wlan0up
- wlan0down
-
- 4. Script and configuration for DHCP
- wlan0dhcp
- ifcfg-wlan0
- 4. Supplicant source code:
- wpa_supplicant-0.4.9.tar.gz
-
- 5. Example of supplicant configuration file:
- wpa1.conf
-
-< Installation >
-Runing the scripts can finish all operations of building up modules
-from the source code and start the nic.
- 1. Build up the drivers from the source code
- ./makedrv
-
- 2. load the driver module to kernel and start up nic
- ./wlan0up
-
-< Set wireless lan MIBs >
-This driver uses Wireless Extension as an interface allowing you to set
-Wireless LAN specific parameters.
-
-Current driver supports "iwlist" to show the device status of nic
- iwlist wlan0 [parameters]
-where
- parameter explaination [parameters]
- ----------------------- -------------
- Show available chan and freq freq / channel
- Show and Scan BSS and IBSS scan[ning]
- Show supported bit-rate rate / bit[rate]
- Show Power Management mode power
-
-For example:
- iwlist wlan0 channel
- iwlist wlan0 scan
- iwlist wlan0 rate
- iwlist wlan0 power
-
-Driver also supports "iwconfig", manipulate driver private ioctls, to set
-MIBs.
-
- iwconfig wlan0 [parameters] [val]
-where
- parameter explaination [parameters] [val] constraints
- ----------------------- ------------- ------------------
- Connect to AP by address ap [mac_addr]
- Set the essid, join (I)BSS essid [essid]
- Set operation mode mode {Managed|Ad-hoc}
- Set keys and security mode key/enc[ryption] {N|open|restricted|off}
-
-For example:
- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
- iwconfig wlan0 essid "ap_name"
- iwconfig wlan0 mode Ad-hoc
- iwconfig wlan0 mode essid "name" mode Ad-hoc
- iwconfig wlan0 key 0123456789 [2] open
- iwconfig wlan0 key off
- iwconfig wlan0 key restricted [3] 0123456789
-
-< Getting IP address >
-After start up the nic, the network needs to obtain an IP address before
-transmit/receive data.
-This can be done by setting the static IP via "ifconfig wlan0 IP_ADDRESS"
-command, or using DHCP.
-
-If using DHCP, setting steps is as below:
- (1)connect to an AP via "iwconfig" settings
- iwconfig wlan0 essid [name] or
- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
-
- (2)run the script which run the dhclient
- ./wlan0dhcp
-
-< WPAPSK >
-WPA_SUPPLICANT help the network to communicate under the protection of WPAPSK
-mechanism
-
- (1)Unpack source code of WPA supplicant:
- tar -zxvf wpa_supplicant-0.4.9.tar.gz
- cd wpa_supplicant-0.4.9
-
- (2)Create .config file:
- cp defconfig .config
-
- (3)Edit .config file, uncomment the following line:
- #CONFIG_DRIVER_IPW=y.
-
- (4)Build WPA supplicant:
- make
-
- (5)Edit wpa_supplicant.conf to set up SSID and its passphrase.
- For example, the following setting in "wpa1.conf" means SSID
- to join is "BufAG54_Ch6" and its passphrase is "87654321".
- network={
- ssid="BufAG54_Ch6"
- proto=WPA
- key_mgmt=WPA-PSK
- pairwise=CCMP TKIP
- group=CCMP TKIP WEP104 WEP40
- psk="87654321"
- priority=2
- }
-
- (6)Execute WPA supplicant (Assume 8187 and related modules had been
- loaded):
- ./wpa_supplicant -D ipw -c wpa1.conf -i wlan0 &
-
diff -Naur rtl8187_linux_26.1010.0622.2006/symvers rtl8187_linux_26.1010.0622.2006.modified/symvers
--- rtl8187_linux_26.1010.0622.2006/symvers 1969-12-31 16:00:00.000000000 -0800
+++ rtl8187_linux_26.1010.0622.2006.modified/symvers 2010-05-19 22:18:52.002707069 -0700
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_linux_26.1010.0622.2006/wlan0rmv rtl8187_linux_26.1010.0622.2006.modified/wlan0rmv
--- rtl8187_linux_26.1010.0622.2006/wlan0rmv 2006-09-05 07:21:10.000000000 -0700
+++ rtl8187_linux_26.1010.0622.2006.modified/wlan0rmv 2010-05-19 22:18:52.006031322 -0700
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmod rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
Patch | aircrack-ng/patches/rtl8187_hw_signal_backport_2.6.28.patch | From: Larry Finger <Larry.Finger@lwfinger.net>
Date: Thu, 4 Dec 2008 04:21:20 +0000 (-0600)
Subject: rtl8187: Improve wireless statistics for RTL8187
X-Git-Tag: master-2009-01-05~191
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Flinville%2Fwireless-testing.git;a=commitdiff_plain;h=cd2865552927d616be4a0da7c24$
rtl8187: Improve wireless statistics for RTL8187
The current wireless statistics for the RTL8187 poorly indicate the signal
strength and quality. With testing, I found that the AGC value is inversely
correlated with the strength as in the RTL8187B. By implementing a similar
calculation, much more code becomes common to the two devices.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested by: MartÃn Ernesto Barreyro <barreyromartin@gmail.com>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Crudely-backported-by: Zero_Chaos <zero_chaos@pentoo.ch>
---
diff -Naur linux-2.6.28-orig/drivers/net/wireless/rtl8187_dev.c linux-2.6.28/drivers/net/wireless/rtl8187_dev.c
--- linux-2.6.28-orig/drivers/net/wireless/rtl8187_dev.c 2009-02-09 16:52:51.000000000 -0500
+++ linux-2.6.28/drivers/net/wireless/rtl8187_dev.c 2009-02-09 17:22:50.000000000 -0500
@@ -303,29 +303,14 @@
struct rtl8187_rx_hdr *hdr =
(typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
flags = le32_to_cpu(hdr->flags);
- signal = hdr->signal & 0x7f;
+ /* As with the RTL8187B below, the AGC is used to calculate
+ * signal strength and quality. In this case, the scaling
+ * constants are derived from the output of p54usb.
+ */
+ quality = 130 - ((41 * hdr->agc) >> 6);
+ signal = -4 - ((27 * hdr->agc) >> 6);
rx_status.antenna = (hdr->signal >> 7) & 1;
- rx_status.noise = hdr->noise;
rx_status.mactime = le64_to_cpu(hdr->mac_time);
- priv->quality = signal;
- rx_status.qual = priv->quality;
- priv->noise = hdr->noise;
- rate = (flags >> 20) & 0xF;
- if (rate > 3) { /* OFDM rate */
- if (signal > 90)
- signal = 90;
- else if (signal < 25)
- signal = 25;
- signal = 90 - signal;
- } else { /* CCK rate */
- if (signal > 95)
- signal = 95;
- else if (signal < 30)
- signal = 30;
- signal = 95 - signal;
- }
- rx_status.signal = signal;
- priv->signal = signal;
} else {
struct rtl8187b_rx_hdr *hdr =
(typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
@@ -343,18 +328,18 @@
*/
flags = le32_to_cpu(hdr->flags);
quality = 170 - hdr->agc;
- if (quality > 100)
- quality = 100;
signal = 14 - hdr->agc / 2;
- rx_status.qual = quality;
- priv->quality = quality;
- rx_status.signal = signal;
- priv->signal = signal;
rx_status.antenna = (hdr->rssi >> 7) & 1;
rx_status.mactime = le64_to_cpu(hdr->mac_time);
- rate = (flags >> 20) & 0xF;
}
+ if (quality > 100)
+ quality = 100;
+ rx_status.qual = quality;
+ priv->quality = quality;
+ rx_status.signal = signal;
+ priv->signal = signal;
+ rate = (flags >> 20) & 0xF;
skb_trim(skb, flags & 0x0FFF);
rx_status.rate_idx = rate;
rx_status.freq = dev->conf.channel->center_freq;
@@ -1065,6 +1050,7 @@
priv->mode = NL80211_IFTYPE_MONITOR;
dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+ IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_RX_INCLUDES_FCS;
eeprom.data = dev;
@@ -1184,10 +1170,6 @@
printk(KERN_WARNING "rtl8187: 8187B chip detected. Support "
"is EXPERIMENTAL, and could damage your\n"
" hardware, use at your own risk\n");
- dev->flags |= IEEE80211_HW_SIGNAL_DBM;
- } else {
- dev->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
- dev->max_signal = 65;
}
dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); |
Patch | aircrack-ng/patches/zd1211rw-inject+dbi-fix-3.7.4.patch | diff -Naur linux/drivers/net/wireless/zd1211rw/zd_mac.c zdpats/drivers/net/wireless/zd1211rw/zd_mac.c
--- linux/drivers/net/wireless/zd1211rw/zd_mac.c 2011-05-19 06:06:34.000000000 +0200
+++ zdpats/drivers/net/wireless/zd1211rw/zd_mac.c 2011-06-25 17:46:33.146013429 +0200
@@ -227,14 +227,19 @@
static int set_rx_filter(struct zd_mac *mac)
{
unsigned long flags;
- u32 filter = STA_RX_FILTER;
+ struct zd_ioreq32 ioreqs[] = {
+ {CR_RX_FILTER, STA_RX_FILTER},
+ { CR_SNIFFER_ON, 0U },
+ };
spin_lock_irqsave(&mac->lock, flags);
- if (mac->pass_ctrl)
- filter |= RX_FILTER_CTRL;
+ if (mac->pass_ctrl) {
+ ioreqs[0].value |= 0xFFFFFFFF;
+ ioreqs[1].value = 0x1;
+ }
spin_unlock_irqrestore(&mac->lock, flags);
- return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
+ return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
}
static int set_mac_and_bssid(struct zd_mac *mac)
@@ -970,7 +975,8 @@
/* Caller has to ensure that length >= sizeof(struct rx_status). */
status = (struct rx_status *)
(buffer + (length - sizeof(struct rx_status)));
- if (status->frame_status & ZD_RX_ERROR) {
+ if ((status->frame_status & ZD_RX_ERROR) ||
+ (status->frame_status & ~0x21)) {
if (mac->pass_failed_fcs &&
(status->frame_status & ZD_RX_CRC32_ERROR)) {
stats.flag |= RX_FLAG_FAILED_FCS_CRC;
@@ -983,7 +989,8 @@
stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq;
stats.band = IEEE80211_BAND_2GHZ;
stats.signal = zd_check_signal(hw, status->signal_strength);
-
+ stats.signal = stats.signal - 90;
+
rate = zd_rx_rate(buffer, status);
/* todo: return index in the big switches in zd_rx_rate instead */
@@ -1312,7 +1319,7 @@
hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
- IEEE80211_HW_SIGNAL_UNSPEC |
+ IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
IEEE80211_HW_MFP_CAPABLE;
hw->wiphy->interface_modes = |
Patch | aircrack-ng/patches/old/aicrack-ng-rc2_Intel_macOSX.patch | Index: sha1-sse2.S
===================================================================
--- sha1-sse2.S (revision 1470)
+++ sha1-sse2.S (working copy)
@@ -21,7 +21,7 @@
.globl _shasse2_cpuid;
.data
-.align(16)
+.align(12)
const_init_a:
.long 0x67452301
.long 0x67452301 |
Patch | aircrack-ng/patches/old/ath5k-frequency-chaos-2.6.27-gentoo-r2.patch | This patch allows for highly extended frequency settings for Atheros wifi cards.
I have tested and confirmed the frequencies as best as I can. Monitoring should be
safe, but transmitting will most likely lead to the fcc paying you a vist. I have
done all I can to stop you from accidently getting in trouble, the rest is up to
you. -ZC
-----------------------------------------------------------------------------------
diff -Naur linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/ath5k.h linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/ath5k.h
--- linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/ath5k.h 2008-10-09 18:13:53.000000000 -0400
+++ linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/ath5k.h 2008-11-12 23:19:12.000000000 -0500
@@ -23,7 +23,7 @@
* long and results timeouts). It's also illegal to tune to some of the
* supported frequencies in some countries, so use this at your own risk,
* you've been warned. */
-#define CHAN_DEBUG 0
+#define CHAN_DEBUG 1
#include <linux/io.h>
#include <linux/types.h>
diff -Naur linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/base.c linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/base.c
--- linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/base.c 2008-10-09 18:13:53.000000000 -0400
+++ linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/base.c 2008-11-12 23:19:12.000000000 -0500
@@ -217,7 +217,7 @@
static void ath5k_detach(struct pci_dev *pdev,
struct ieee80211_hw *hw);
/* Channel/mode setup */
-static inline short ath5k_ieee2mhz(short chan);
+static inline short ath5k_ieee2mhz(int chan, unsigned int chfreq);
static unsigned int ath5k_copy_rates(struct ieee80211_rate *rates,
const struct ath5k_rate_table *rt,
unsigned int max);
@@ -804,12 +804,15 @@
* Convert IEEE channel number to MHz frequency.
*/
static inline short
-ath5k_ieee2mhz(short chan)
+ath5k_ieee2mhz(int chan, unsigned int chfreq)
{
- if (chan <= 14 || chan >= 27)
- return ieee80211chan2mhz(chan);
+ if (chfreq == CHANNEL_5GHZ)
+ return (chan + 1000) * 5;
else
- return 2212 + chan * 20;
+ if (chan <= 14 || chan >= 27)
+ return ieee80211chan2mhz(chan);
+ else
+ return 2212 + chan * 20;
}
static unsigned int
@@ -839,7 +842,8 @@
unsigned int mode,
unsigned int max)
{
- unsigned int i, count, size, chfreq, freq, ch;
+ unsigned int i, count, size, chfreq, freq;
+ int ch;
if (!test_bit(mode, ah->ah_modes))
return 0;
@@ -847,14 +851,17 @@
switch (mode) {
case AR5K_MODE_11A:
case AR5K_MODE_11A_TURBO:
- /* 1..220, but 2GHz frequencies are filtered by check_channel */
- size = 220 ;
+ /* -16..220 */
+ size = 241 ;
+ ch = -40;
chfreq = CHANNEL_5GHZ;
break;
case AR5K_MODE_11B:
case AR5K_MODE_11G:
case AR5K_MODE_11G_TURBO:
- size = 26;
+ /* -19..26 */
+ size = 70;
+ ch = -42;
chfreq = CHANNEL_2GHZ;
break;
default:
@@ -862,9 +869,8 @@
return 0;
}
- for (i = 0, count = 0; i < size && max > 0; i++) {
- ch = i + 1 ;
- freq = ath5k_ieee2mhz(ch);
+ for (i = 0, count = 0; i < size && max > 0; i++,ch++) {
+ freq = ath5k_ieee2mhz(ch,chfreq);
/* Check if channel is supported by the chipset */
if (!ath5k_channel_ok(ah, freq, chfreq))
diff -Naur linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/base.h linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/base.h
--- linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/base.h 2008-10-09 18:13:53.000000000 -0400
+++ linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/base.h 2008-11-12 23:27:26.000000000 -0500
@@ -51,8 +51,8 @@
#include "debug.h"
#define ATH_RXBUF 40 /* number of RX buffers */
-#define ATH_TXBUF 200 /* number of TX buffers */
-#define ATH_BCBUF 1 /* number of beacon buffers */
+#define ATH_TXBUF 0 /* number of TX buffers */
+#define ATH_BCBUF 0 /* number of beacon buffers */
struct ath5k_buf {
struct list_head list;
diff -Naur linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/hw.c linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/hw.c
--- linux-2.6.27-gentoo-r2/drivers/net/wireless/ath5k/hw.c 2008-10-09 18:13:53.000000000 -0400
+++ linux-2.6.27-gentoo-r2-afc/drivers/net/wireless/ath5k/hw.c 2008-11-12 23:21:29.000000000 -0500
@@ -2319,8 +2319,9 @@
*/
if (AR5K_EEPROM_HDR_11A(ee_header)) {
- ah->ah_capabilities.cap_range.range_5ghz_min = 5005; /* 4920 */
- ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
+ ah->ah_capabilities.cap_range.range_5ghz_min = 4800; /* 4920 */
+ ah->ah_capabilities.cap_range.range_5ghz_max = 6000; /* 6100 is what the code said but */
+ /* it fried one of my cards */
/* Set supported modes */
__set_bit(AR5K_MODE_11A,
@@ -2336,8 +2337,8 @@
* connected */
if (AR5K_EEPROM_HDR_11B(ee_header) ||
AR5K_EEPROM_HDR_11G(ee_header)) {
- ah->ah_capabilities.cap_range.range_2ghz_min = 2412; /* 2312 */
- ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
+ ah->ah_capabilities.cap_range.range_2ghz_min = 2192; /* 2312 */
+ ah->ah_capabilities.cap_range.range_2ghz_max = 2737; /* 2732 */
if (AR5K_EEPROM_HDR_11B(ee_header))
__set_bit(AR5K_MODE_11B,
@@ -2379,24 +2380,6 @@
ATH5K_TRACE(ah->ah_sc);
switch (ah->ah_op_mode) {
- case IEEE80211_IF_TYPE_IBSS:
- pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_DESC_ANTENNA |
- (ah->ah_version == AR5K_AR5210 ?
- AR5K_STA_ID1_NO_PSPOLL : 0);
- beacon_reg |= AR5K_BCR_ADHOC;
- break;
-
- case IEEE80211_IF_TYPE_AP:
- pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_RTS_DEF_ANTENNA |
- (ah->ah_version == AR5K_AR5210 ?
- AR5K_STA_ID1_NO_PSPOLL : 0);
- beacon_reg |= AR5K_BCR_AP;
- break;
-
- case IEEE80211_IF_TYPE_STA:
- pcu_reg |= AR5K_STA_ID1_DEFAULT_ANTENNA |
- (ah->ah_version == AR5K_AR5210 ?
- AR5K_STA_ID1_PWR_SV : 0);
case IEEE80211_IF_TYPE_MNTR:
pcu_reg |= AR5K_STA_ID1_DEFAULT_ANTENNA |
(ah->ah_version == AR5K_AR5210 ?
diff -Naur linux-2.6.27-gentoo-r2/net/wireless/reg.c linux-2.6.27-gentoo-r2-afc/net/wireless/reg.c
--- linux-2.6.27-gentoo-r2/net/wireless/reg.c 2008-10-09 18:13:53.000000000 -0400
+++ linux-2.6.27-gentoo-r2-afc/net/wireless/reg.c 2008-11-12 23:23:53.000000000 -0500
@@ -70,6 +70,22 @@
RANGE_PWR(5745, 5825, 30, 6, 0),
};
+static const struct ieee80211_channel_range ieee80211_DEBUG_channels[] = {
+/*
+ * WARNING: These values are strictly based on my own limited testing.
+ * This does not seem to damage MY cards in the limited time I was testing.
+ * Monitor mode tuning of these channels *should* be 100% safe, however,
+ * ANY transmissions may not only permanently damage your card, it may also
+ * bring the feds down on you.
+ *
+ */
+ /* IEEE 802.11b/g, channels -42..26 */
+ RANGE_PWR(2192, 2732, 1, 6, 0),
+ /* IEEE 802.11a, channels -40..240, outdoor */
+ RANGE_PWR(4800, 6000, 1, 6, 0),
+};
+
+
static const struct ieee80211_channel_range ieee80211_JP_channels[] = {
/* IEEE 802.11b/g, channels 1..14 */
RANGE_PWR(2412, 2484, 20, 6, 0),
@@ -108,6 +124,7 @@
REGDOM(US),
REGDOM(JP),
REGDOM(EU),
+ REGDOM(DEBUG),
}; |
Patch | aircrack-ng/patches/old/ath5k-frequency-chaos_2.6.26.2.patch | This patch allows for highly extended frequency settings for Atheros wifi cards.
I have tested and confirmed the frequencies as best as I can. Monitoring should be
safe, but transmitting will most likely lead to the fcc paying you a vist. I have
done all I can to stop you from accidently getting in trouble, the rest is up to
you. -ZC
-----------------------------------------------------------------------------------
diff -Naur linux-2.6.26.2/drivers/net/wireless/ath5k/ath5k.h linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/ath5k.h
--- linux-2.6.26.2/drivers/net/wireless/ath5k/ath5k.h 2008-08-13 03:16:40.000000000 -0400
+++ linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/ath5k.h 2008-08-13 03:16:47.000000000 -0400
@@ -23,7 +23,7 @@
* long and results timeouts). It's also illegal to tune to some of the
* supported frequencies in some countries, so use this at your own risk,
* you've been warned. */
-#define CHAN_DEBUG 0
+#define CHAN_DEBUG 1
#include <linux/io.h>
#include <linux/types.h>
diff -Naur linux-2.6.26.2/drivers/net/wireless/ath5k/base.c linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/base.c
--- linux-2.6.26.2/drivers/net/wireless/ath5k/base.c 2008-08-13 03:16:40.000000000 -0400
+++ linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/base.c 2008-08-13 03:16:47.000000000 -0400
@@ -226,7 +226,7 @@
static void ath5k_detach(struct pci_dev *pdev,
struct ieee80211_hw *hw);
/* Channel/mode setup */
-static inline short ath5k_ieee2mhz(short chan);
+static inline short ath5k_ieee2mhz(int chan, unsigned int chfreq);
static unsigned int ath5k_copy_rates(struct ieee80211_rate *rates,
const struct ath5k_rate_table *rt,
unsigned int max);
@@ -830,12 +830,15 @@
* Convert IEEE channel number to MHz frequency.
*/
static inline short
-ath5k_ieee2mhz(short chan)
+ath5k_ieee2mhz(int chan, unsigned int chfreq)
{
- if (chan <= 14 || chan >= 27)
- return ieee80211chan2mhz(chan);
+ if (chfreq == CHANNEL_5GHZ)
+ return (chan + 1000) * 5;
else
- return 2212 + chan * 20;
+ if (chan <= 14 || chan >= 27)
+ return ieee80211chan2mhz(chan);
+ else
+ return 2212 + chan * 20;
}
static unsigned int
@@ -865,7 +868,8 @@
unsigned int mode,
unsigned int max)
{
- unsigned int i, count, size, chfreq, freq, ch;
+ unsigned int i, count, size, chfreq, freq;
+ int ch;
if (!test_bit(mode, ah->ah_modes))
return 0;
@@ -873,14 +877,17 @@
switch (mode) {
case AR5K_MODE_11A:
case AR5K_MODE_11A_TURBO:
- /* 1..220, but 2GHz frequencies are filtered by check_channel */
- size = 220 ;
+ /* -16..220 */
+ size = 241 ;
+ ch = -40;
chfreq = CHANNEL_5GHZ;
break;
case AR5K_MODE_11B:
case AR5K_MODE_11G:
case AR5K_MODE_11G_TURBO:
- size = 26;
+ /* -19..26 */
+ size = 70;
+ ch = -42;
chfreq = CHANNEL_2GHZ;
break;
default:
@@ -888,9 +895,8 @@
return 0;
}
- for (i = 0, count = 0; i < size && max > 0; i++) {
- ch = i + 1 ;
- freq = ath5k_ieee2mhz(ch);
+ for (i = 0, count = 0; i < size && max > 0; i++,ch++) {
+ freq = ath5k_ieee2mhz(ch,chfreq);
/* Check if channel is supported by the chipset */
if (!ath5k_channel_ok(ah, freq, chfreq))
diff -Naur linux-2.6.26.2/drivers/net/wireless/ath5k/base.h linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/base.h
--- linux-2.6.26.2/drivers/net/wireless/ath5k/base.h 2008-08-13 03:16:40.000000000 -0400
+++ linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/base.h 2008-08-13 03:16:47.000000000 -0400
@@ -50,7 +50,7 @@
#include "debug.h"
#define ATH_RXBUF 40 /* number of RX buffers */
-#define ATH_TXBUF 200 /* number of TX buffers */
+#define ATH_TXBUF 0 /* number of TX buffers */
#define ATH_BCBUF 1 /* number of beacon buffers */
struct ath5k_buf {
diff -Naur linux-2.6.26.2/drivers/net/wireless/ath5k/hw.c linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/hw.c
--- linux-2.6.26.2/drivers/net/wireless/ath5k/hw.c 2008-08-13 03:16:40.000000000 -0400
+++ linux-2.6.26.2-ath5k-freq-chaos/drivers/net/wireless/ath5k/hw.c 2008-08-13 03:16:47.000000000 -0400
@@ -2258,8 +2258,9 @@
*/
if (AR5K_EEPROM_HDR_11A(ee_header)) {
- ah->ah_capabilities.cap_range.range_5ghz_min = 5005; /* 4920 */
- ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
+ ah->ah_capabilities.cap_range.range_5ghz_min = 4800; /* 4920 */
+ ah->ah_capabilities.cap_range.range_5ghz_max = 6000; /* 6100 is what atheros said but */
+ /* it fried one of my cards */
/* Set supported modes */
__set_bit(AR5K_MODE_11A,
@@ -2275,8 +2276,8 @@
* connected */
if (AR5K_EEPROM_HDR_11B(ee_header) ||
AR5K_EEPROM_HDR_11G(ee_header)) {
- ah->ah_capabilities.cap_range.range_2ghz_min = 2412; /* 2312 */
- ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
+ ah->ah_capabilities.cap_range.range_2ghz_min = 2192; /* 2312 */
+ ah->ah_capabilities.cap_range.range_2ghz_max = 2737; /* 2732 */
if (AR5K_EEPROM_HDR_11B(ee_header))
__set_bit(AR5K_MODE_11B,
diff -Naur linux-2.6.26.2/net/wireless/reg.c linux-2.6.26.2-ath5k-freq-chaos/net/wireless/reg.c
--- linux-2.6.26.2/net/wireless/reg.c 2008-08-13 03:16:40.000000000 -0400
+++ linux-2.6.26.2-ath5k-freq-chaos/net/wireless/reg.c 2008-08-13 03:16:47.000000000 -0400
@@ -70,6 +70,22 @@
RANGE_PWR(5745, 5825, 30, 6, 0),
};
+static const struct ieee80211_channel_range ieee80211_DEBUG_channels[] = {
+/*
+ * WARNING: These values are strictly based on my own limited testing.
+ * This does not seem to damage MY cards in the limited time I was testing.
+ * Monitor mode tuning of these channels *should* be 100% safe, however,
+ * ANY transmissions may not only permanently damage your card, it may also
+ * bring the feds down on you.
+ *
+ */
+ /* IEEE 802.11b/g, channels -42..26 */
+ RANGE_PWR(2192, 2732, 1, 6, 0),
+ /* IEEE 802.11a, channels -40..240, outdoor */
+ RANGE_PWR(4800, 6000, 1, 6, 0),
+};
+
+
static const struct ieee80211_channel_range ieee80211_JP_channels[] = {
/* IEEE 802.11b/g, channels 1..14 */
RANGE_PWR(2412, 2484, 20, 6, 0),
@@ -108,6 +124,7 @@
REGDOM(US),
REGDOM(JP),
REGDOM(EU),
+ REGDOM(DEBUG),
}; |
Patch | aircrack-ng/patches/old/b43-injection-2.6.25-wl.patch | diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index a37d7fa..5655688 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2841,6 +2841,10 @@ static int b43_op_tx(struct ieee80211_hw *hw,
err = b43_dma_tx(dev, skb, ctl);
}
+ if (ctl->type == IEEE80211_IF_TYPE_MNTR) {
+ ctl->flags |= IEEE80211_TXCTL_NO_ACK;
+ }
+
read_unlock_irqrestore(&wl->tx_lock, flags);
if (unlikely(err))
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 8849194..bfc1665 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -318,7 +318,8 @@ int b43_generate_txhdr(struct b43_wldev *dev,
/* MAC control */
if (!(txctl->flags & IEEE80211_TXCTL_NO_ACK))
mac_ctl |= B43_TXH_MAC_ACK;
- if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
+ if ( (txctl->type != IEEE80211_IF_TYPE_MNTR) &&
+ !(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
mac_ctl |= B43_TXH_MAC_HWSEQ;
if (txctl->flags & IEEE80211_TXCTL_FIRST_FRAGMENT)
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index a353dae..14ef22e 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2370,6 +2370,11 @@ static int b43legacy_op_tx(struct ieee80211_hw *hw,
goto out;
if (unlikely(b43legacy_status(dev) < B43legacy_STAT_STARTED))
goto out;
+
+ if (ctl->type == IEEE80211_IF_TYPE_MNTR) {
+ ctl->flags |= IEEE80211_TXCTL_NO_ACK;
+ }
+
/* DMA-TX is done without a global lock. */
if (b43legacy_using_pio(dev)) {
spin_lock_irqsave(&wl->irq_lock, flags);
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index fc83dab..b4c6ebb 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -292,7 +292,8 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
/* MAC control */
if (!(txctl->flags & IEEE80211_TXCTL_NO_ACK))
mac_ctl |= B43legacy_TX4_MAC_ACK;
- if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
+ if ( (txctl->type != IEEE80211_IF_TYPE_MNTR) &&
+ !(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
mac_ctl |= B43legacy_TX4_MAC_HWSEQ;
if (txctl->flags & IEEE80211_TXCTL_FIRST_FRAGMENT) |
Patch | aircrack-ng/patches/old/b43-injection-2.6.26-rc6-wl.patch | diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index f9e1cff..d2d4f37 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -315,9 +315,15 @@ int b43_generate_txhdr(struct b43_wldev *dev,
}
/* MAC control */
- if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ /* dev->wl->if_type returns IEEE80211_IF_TYPE_INVALID instead of
+ * IEEE80211_IF_TYPE_MNTR for monitor interfaces, as monitor mode
+ * is not considered "operating" by mac80211.
+ */
+ if (dev->wl->if_type != 5 && dev->wl->if_type != 0 &&
+ !(info->flags & IEEE80211_TX_CTL_NO_ACK))
mac_ctl |= B43_TXH_MAC_ACK;
- if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
+ if (dev->wl->if_type != 5 && dev->wl->if_type != 0 &&
+ !(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
mac_ctl |= B43_TXH_MAC_HWSEQ;
if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index 82dc04d..1f9f443 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -293,9 +293,15 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
}
/* MAC control */
- if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ /* dev->wl->if_type returns IEEE80211_IF_TYPE_INVALID instead of
+ * IEEE80211_IF_TYPE_MNTR for monitor interfaces, as monitor mode
+ * is not considered "operating" by mac80211.
+ */
+ if (dev->wl->if_type != 5 && dev->wl->if_type != 0 &&
+ !(info->flags & IEEE80211_TX_CTL_NO_ACK))
mac_ctl |= B43legacy_TX4_MAC_ACK;
- if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
+ if (dev->wl->if_type != 5 && dev->wl->if_type != 0 &&
+ !(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
mac_ctl |= B43legacy_TX4_MAC_HWSEQ;
if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
Patch | aircrack-ng/patches/old/bcm43xx-injection-linux-2.6.22.patch | --- linux-source-2.6.22/drivers/net/wireless/bcm43xx/bcm43xx_main.c 2007-10-08 10:14:25.000000000 +1300
+++ linux-source-2.6.22-bcm43xx-patch/drivers/net/wireless/bcm43xx/bcm43xx_main.c 2007-10-08 10:13:12.000000000 +1300
@@ -3324,9 +3324,17 @@
}
/* This is the opposite of bcm43xx_init_board() */
+
+static ssize_t bcm43xx_inject_nofcs(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t cnt);
+static DEVICE_ATTR(inject_nofcs, 0200,
+ NULL, bcm43xx_inject_nofcs);
static void bcm43xx_free_board(struct bcm43xx_private *bcm)
{
bcm43xx_rng_exit(bcm);
+ device_remove_file(&bcm->pci_dev->dev, &dev_attr_inject_nofcs);
bcm43xx_sysfs_unregister(bcm);
mutex_lock(&(bcm)->mutex);
@@ -3581,6 +3589,9 @@
return err;
}
+
+
+
static int bcm43xx_init_board(struct bcm43xx_private *bcm)
{
int err;
@@ -3603,6 +3614,9 @@
err = bcm43xx_rng_init(bcm);
if (err)
goto err_sysfs_unreg;
+ err = device_create_file(&bcm->pci_dev->dev, &dev_attr_inject_nofcs);
+ if (err)
+ goto err_inject_if;
bcm43xx_periodic_tasks_setup(bcm);
/*FIXME: This should be handled by softmac instead. */
@@ -3613,6 +3627,9 @@
return err;
+err_inject_if:
+ device_remove_file(&bcm->pci_dev->dev, &dev_attr_inject_nofcs);
+
err_sysfs_unreg:
bcm43xx_sysfs_unregister(bcm);
err_wlshutdown:
@@ -3866,6 +3883,49 @@
return err;
}
+static ssize_t bcm43xx_inject_nofcs(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t cnt)
+{
+ struct bcm43xx_private *bcm = dev_to_bcm(dev);
+ struct ieee80211_txb *faketxb;
+ struct sk_buff *skb;
+ unsigned long flags;
+ int err = -ENODEV;
+
+ faketxb = kzalloc(sizeof(struct ieee80211_txb) + sizeof(void *), GFP_KERNEL);
+ if (!faketxb)
+ return -ENOMEM;
+ faketxb->nr_frags = 1;
+ faketxb->frag_size = cnt;
+ faketxb->payload_size = cnt;
+ skb = __dev_alloc_skb(cnt + bcm->ieee->tx_headroom, GFP_KERNEL);
+ if (!skb) {
+ kfree(faketxb);
+ return -ENOMEM;
+ }
+ skb_reserve(skb, bcm->ieee->tx_headroom);
+ memcpy(skb_put(skb, cnt), buf, cnt);
+ faketxb->fragments[0] = skb;
+
+ spin_lock_irqsave(&bcm->irq_lock, flags);
+
+ if (likely(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED))
+ err = bcm43xx_tx(bcm, faketxb);
+
+ spin_unlock_irqrestore(&bcm->irq_lock, flags);
+
+ if (unlikely(err)) {
+ dev_kfree_skb(skb);
+ kfree(faketxb);
+ return err;
+ }
+
+ return cnt;
+}
+
+
static void bcm43xx_ieee80211_set_chan(struct net_device *net_dev,
u8 channel)
{ |
Patch | aircrack-ng/patches/old/hostap-driver-0.3.9.patch | diff -ur ../hostap-driver-0.3.9/driver/modules/hostap.c ./driver/modules/hostap.c
--- ../hostap-driver-0.3.9/driver/modules/hostap.c 2004-08-28 05:26:46.000000000 +0200
+++ ./driver/modules/hostap.c 2005-07-29 12:13:38.000000000 +0200
@@ -401,7 +401,7 @@
if (local->iw_mode == IW_MODE_REPEAT)
return HFA384X_PORTTYPE_WDS;
if (local->iw_mode == IW_MODE_MONITOR)
- return HFA384X_PORTTYPE_PSEUDO_IBSS;
+ return 5; /*HFA384X_PORTTYPE_PSEUDO_IBSS;*/
return HFA384X_PORTTYPE_HOSTAP;
}
diff -ur ../hostap-driver-0.3.9/driver/modules/hostap_80211_tx.c ./driver/modules/hostap_80211_tx.c
--- ../hostap-driver-0.3.9/driver/modules/hostap_80211_tx.c 2004-07-06 01:45:01.000000000 +0200
+++ ./driver/modules/hostap_80211_tx.c 2005-07-29 12:26:05.000000000 +0200
@@ -51,6 +51,9 @@
int to_assoc_ap = 0;
struct hostap_skb_tx_data *meta;
+ if (local->iw_mode == IW_MODE_MONITOR)
+ goto xmit;
+
if (skb->len < ETH_HLEN) {
printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb "
"(len=%d)\n", dev->name, skb->len);
@@ -216,6 +219,7 @@
memcpy(skb_put(skb, ETH_ALEN), &hdr.addr4, ETH_ALEN);
}
+xmit:
iface->stats.tx_packets++;
iface->stats.tx_bytes += skb->len;
@@ -376,8 +380,6 @@
}
if (skb->len < 24) {
- printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb "
- "(len=%d)\n", dev->name, skb->len);
ret = 0;
iface->stats.tx_dropped++;
goto fail;
diff -ur ../hostap-driver-0.3.9/driver/modules/hostap_config.h ./driver/modules/hostap_config.h
--- ../hostap-driver-0.3.9/driver/modules/hostap_config.h 2005-06-11 05:03:36.000000000 +0200
+++ ./driver/modules/hostap_config.h 2005-07-29 12:13:38.000000000 +0200
@@ -59,7 +59,7 @@
* In addition, please note that it is possible to kill your card with
* non-volatile download if you are using incorrect image. This feature has not
* been fully tested, so please be careful with it. */
-/* #define PRISM2_NON_VOLATILE_DOWNLOAD */
+#define PRISM2_NON_VOLATILE_DOWNLOAD
#endif /* PRISM2_DOWNLOAD_SUPPORT */
/* Include wireless extensions sub-ioctl support even if wireless extensions
diff -ur ../hostap-driver-0.3.9/driver/modules/hostap_hw.c ./driver/modules/hostap_hw.c
--- ../hostap-driver-0.3.9/driver/modules/hostap_hw.c 2005-05-18 05:31:21.000000000 +0200
+++ ./driver/modules/hostap_hw.c 2005-07-29 12:13:38.000000000 +0200
@@ -1005,6 +1005,35 @@
return fid;
}
+static int prism2_monitor_enable(struct net_device *dev)
+{
+ if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, 5)) {
+ printk(KERN_DEBUG "Port type setting for monitor mode "
+ "failed\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hfa384x_cmd(dev, HFA384X_CMDCODE_TEST | (0x0a << 8),
+ 0, NULL, NULL)) {
+ printk(KERN_DEBUG "Could not enter testmode 0x0a\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS,
+ HFA384X_WEPFLAGS_PRIVACYINVOKED |
+ HFA384X_WEPFLAGS_HOSTENCRYPT |
+ HFA384X_WEPFLAGS_HOSTDECRYPT)) {
+ printk(KERN_DEBUG "WEP flags setting failed\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, 1)) {
+ printk(KERN_DEBUG "Could not set promiscuous mode\n");
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
static int prism2_reset_port(struct net_device *dev)
{
@@ -1028,6 +1057,10 @@
"port\n", dev->name);
}
+ if (local->iw_mode == IW_MODE_MONITOR)
+ /* force mode 0x0a after port 0 reset */
+ return prism2_monitor_enable(dev);
+
/* It looks like at least some STA firmware versions reset
* fragmentation threshold back to 2346 after enable command. Restore
* the configured value, if it differs from this default. */
@@ -1444,6 +1477,10 @@
return 1;
}
+ if (local->iw_mode == IW_MODE_MONITOR)
+ /* force mode 0x0a after port 0 reset */
+ prism2_monitor_enable(dev);
+
local->hw_ready = 1;
local->hw_reset_tries = 0;
local->hw_resetting = 0;
@@ -3259,6 +3296,7 @@
local->func->hw_config = prism2_hw_config;
local->func->hw_reset = prism2_hw_reset;
local->func->hw_shutdown = prism2_hw_shutdown;
+ local->func->monitor_enable = prism2_monitor_enable;
local->func->reset_port = prism2_reset_port;
local->func->schedule_reset = prism2_schedule_reset;
#ifdef PRISM2_DOWNLOAD_SUPPORT
diff -ur ../hostap-driver-0.3.9/driver/modules/hostap_ioctl.c ./driver/modules/hostap_ioctl.c
--- ../hostap-driver-0.3.9/driver/modules/hostap_ioctl.c 2005-05-18 05:33:28.000000000 +0200
+++ ./driver/modules/hostap_ioctl.c 2005-07-29 12:13:38.000000000 +0200
@@ -1067,33 +1067,7 @@
printk(KERN_DEBUG "Enabling monitor mode\n");
hostap_monitor_set_type(local);
-
- if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE,
- HFA384X_PORTTYPE_PSEUDO_IBSS)) {
- printk(KERN_DEBUG "Port type setting for monitor mode "
- "failed\n");
- return -EOPNOTSUPP;
- }
-
- /* Host decrypt is needed to get the IV and ICV fields;
- * however, monitor mode seems to remove WEP flag from frame
- * control field */
- if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS,
- HFA384X_WEPFLAGS_HOSTENCRYPT |
- HFA384X_WEPFLAGS_HOSTDECRYPT)) {
- printk(KERN_DEBUG "WEP flags setting failed\n");
- return -EOPNOTSUPP;
- }
-
- if (local->func->reset_port(dev) ||
- local->func->cmd(dev, HFA384X_CMDCODE_TEST |
- (HFA384X_TEST_MONITOR << 8),
- 0, NULL, NULL)) {
- printk(KERN_DEBUG "Setting monitor mode failed\n");
- return -EOPNOTSUPP;
- }
-
- return 0;
+ return local->func->reset_port(dev);
}
@@ -1159,7 +1133,7 @@
local->iw_mode = *mode;
if (local->iw_mode == IW_MODE_MONITOR)
- hostap_monitor_mode_enable(local);
+ return hostap_monitor_mode_enable(local);
else if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt &&
!local->fw_encrypt_ok) {
printk(KERN_DEBUG "%s: defaulting to host-based encryption as "
diff -ur ../hostap-driver-0.3.9/driver/modules/hostap_wlan.h ./driver/modules/hostap_wlan.h
--- ../hostap-driver-0.3.9/driver/modules/hostap_wlan.h 2005-05-18 05:31:22.000000000 +0200
+++ ./driver/modules/hostap_wlan.h 2005-07-29 12:13:38.000000000 +0200
@@ -591,6 +591,7 @@
int (*hw_config)(struct net_device *dev, int initial);
void (*hw_reset)(struct net_device *dev);
void (*hw_shutdown)(struct net_device *dev, int no_disable);
+ int (*monitor_enable)(struct net_device *dev);
int (*reset_port)(struct net_device *dev);
void (*schedule_reset)(local_info_t *local);
int (*download)(local_info_t *local, |
Patch | aircrack-ng/patches/old/hostap-driver-0.4.5.patch | diff -ur ../hostap-driver-0.4.5/driver/etc/hostap_cs.conf ./driver/etc/hostap_cs.conf
--- ../hostap-driver-0.4.5/driver/etc/hostap_cs.conf 2005-05-23 18:01:03.000000000 +0200
+++ ./driver/etc/hostap_cs.conf 2005-11-21 13:49:16.000000000 +0100
@@ -102,17 +102,17 @@
card "Level-One WPC-0100"
version "Digital Data Communications", "WPC-0100", "Version 00.00"
- manfid 0x0156, 0x0002
+# manfid 0x0156, 0x0002
bind "hostap_cs"
card "Belkin 802.11b WLAN PCMCIA"
version "Belkin", "11Mbps Wireless Notebook Network Adapter", "Version 01.02"
- manfid 0x0156, 0x0002
+# manfid 0x0156, 0x0002
bind "hostap_cs"
card "Senao SL-2011CD/SL-2011CDPLUS"
version "INTERSIL", "HFA384x/IEEE", "Version 01.02"
- manfid 0x0156, 0x0002
+# manfid 0x0156, 0x0002
bind "hostap_cs"
card "Fulbond Airbond XI-300B"
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap_80211_tx.c ./driver/modules/hostap_80211_tx.c
--- ../hostap-driver-0.4.5/driver/modules/hostap_80211_tx.c 2005-08-06 19:55:14.000000000 +0200
+++ ./driver/modules/hostap_80211_tx.c 2005-11-21 13:49:16.000000000 +0100
@@ -51,6 +51,9 @@
int to_assoc_ap = 0;
struct hostap_skb_tx_data *meta;
+ if (local->iw_mode == IW_MODE_MONITOR)
+ goto xmit;
+
if (skb->len < ETH_HLEN) {
printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb "
"(len=%d)\n", dev->name, skb->len);
@@ -216,6 +219,7 @@
memcpy(skb_put(skb, ETH_ALEN), &hdr.addr4, ETH_ALEN);
}
+xmit:
iface->stats.tx_packets++;
iface->stats.tx_bytes += skb->len;
@@ -377,8 +381,6 @@
}
if (skb->len < 24) {
- printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb "
- "(len=%d)\n", dev->name, skb->len);
ret = 0;
iface->stats.tx_dropped++;
goto fail;
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap.c ./driver/modules/hostap.c
--- ../hostap-driver-0.4.5/driver/modules/hostap.c 2005-08-06 19:47:10.000000000 +0200
+++ ./driver/modules/hostap.c 2005-11-21 13:49:16.000000000 +0100
@@ -407,7 +407,7 @@
if (local->iw_mode == IW_MODE_REPEAT)
return HFA384X_PORTTYPE_WDS;
if (local->iw_mode == IW_MODE_MONITOR)
- return HFA384X_PORTTYPE_PSEUDO_IBSS;
+ return 5; /*HFA384X_PORTTYPE_PSEUDO_IBSS;*/
return HFA384X_PORTTYPE_HOSTAP;
}
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap_config.h ./driver/modules/hostap_config.h
--- ../hostap-driver-0.4.5/driver/modules/hostap_config.h 2005-09-26 03:42:30.000000000 +0200
+++ ./driver/modules/hostap_config.h 2005-11-21 13:49:16.000000000 +0100
@@ -59,7 +59,7 @@
* In addition, please note that it is possible to kill your card with
* non-volatile download if you are using incorrect image. This feature has not
* been fully tested, so please be careful with it. */
-/* #define PRISM2_NON_VOLATILE_DOWNLOAD */
+#define PRISM2_NON_VOLATILE_DOWNLOAD
#endif /* PRISM2_DOWNLOAD_SUPPORT */
/* Include wireless extensions sub-ioctl support even if wireless extensions
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap_cs.c ./driver/modules/hostap_cs.c
--- ../hostap-driver-0.4.5/driver/modules/hostap_cs.c 2005-09-18 05:51:09.000000000 +0200
+++ ./driver/modules/hostap_cs.c 2005-11-21 16:23:02.000000000 +0100
@@ -929,51 +929,97 @@
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,67)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13))
static struct pcmcia_device_id hostap_cs_ids[] = {
- PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
- PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
- PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
- PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
- PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
- PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
- PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
- PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
- PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
- PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
- PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
- 0x7a954bd9, 0x74be00c6),
- PCMCIA_DEVICE_PROD_ID1234(
- "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P",
- "Eval-RevA",
- 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
- PCMCIA_DEVICE_PROD_ID123(
- "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
- 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
- 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "Instant Wireless ", " Network PC CARD", "Version 01.02",
- 0x11d901af, 0x6e9bd926, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "SMC", "SMC2632W", "Version 01.02",
- 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
- 0x54f7c49c, 0x15a75e5b),
- PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
- 0x74c5e40d, 0xdb472a18),
- PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
- 0x0733cc81, 0x0c52f395),
- PCMCIA_DEVICE_PROD_ID12(
- "ZoomAir 11Mbps High", "Rate wireless Networking",
- 0x273fe3db, 0x32a1eaee),
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), // SonicWALL Long Range Wireless Card
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7110), // D-Link DWL-650 rev P 802.11b WLAN card
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), // Sohoware NCP110, Philips 802.11b
+// PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001), // Intel PRO/Wireless 2011 (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), // AnyPoint(TM) Wireless II PC Card
+ PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), // 3Com AirConnect PCI 777A
+ PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), // PROXIM RangeLAN-DS/LAN PC CARD
+ PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), // Compaq WL100 11 Mbps Wireless Adapter
+// PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), // Mostly Lucent Orinoco (HermesI), but also some Prism2 :(
+// PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), // Ericsson WLAN Card C11 (Symbol24)
+// PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), // Nortel eMobility 802.11 Wireless Adapter (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), // Intermec MobileLAN 11Mbps 802.11b WLAN Card
+ PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), // Samsung SWL2000-N 11Mb/s WLAN Card
+// PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), // AirWay 802.11 Adapter (HermesI)
+// PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), // ARtem Onair (HermesI)
+// PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), // Symbol Technologies LA4111 (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), // Buffalo WLI-PCM-S11
+ PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), // Linksys WPC11 Version 2.5
+ PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), // Linksys WPC11 Version 3
+ PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), // Compaq HNW-100 11 Mbps Wireless Adapter
+ PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), // Linksys WCF12 11Mbps 802.11b WLAN Card (Prism 3)
+ PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), // ASUS SpaceLink WL-100
+ PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), // SpeedStream SS1021 Wireless Adapter
+ PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x3021), // SpeedStream SS1021 Wireless Adapter (newer)
+ PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001), // Microsoft Wireless Notebook Adapter MN-520
+ PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), // PLANEX RoadLannerWave GW-NS11H
+ PCMCIA_DEVICE_MANF_CARD(0x1668, 0x0101), // ActionTec 802CI2/HCW01170-01
+ PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001), // Airvast ?
+ PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), // Airvast WN-100
+ PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), // Adaptec Ultra Wireless ANW-8030
+ PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), // CONTEC FLEXSCAN/FX-DDS110-PCC
+ PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), // Corega KK Wireless LAN PCC-11
+ PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), // Conceptronic CON11Cpro, EMTAC A2424i
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), // Safeway 802.11b, ZCOMAX AirRunner/XI-300
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), // D-Link DCF660, ZCOMAX XI-325HP 200mw
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), // SMC2532W-B V2
+
+ PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
+ PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9),
+// PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5),
+ PCMCIA_DEVICE_PROD_ID123("Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02", 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
+ PCMCIA_DEVICE_PROD_ID123("AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863", 0xea569531, 0x4bcb9645, 0x355cb092),
+ PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f),
+ PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842),
+ PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e),
+// PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb),
+// PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18),
+// PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b),
+ PCMCIA_DEVICE_PROD_ID123("corega", "WL PCCL-11", "ISL37300P", 0x0a21501a, 0x59868926, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584),
+ PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9),
+ PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac),
+ PCMCIA_DEVICE_PROD_ID123("D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02", 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
+// PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146),
+// PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
+ PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
+// PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77),
+ PCMCIA_DEVICE_PROD_ID1234("Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P", "Eval-RevA", 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
+ PCMCIA_DEVICE_PROD_ID123("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", 0x4b801a17, 0xf222ec2d, 0x630d52b2),
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
+ PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92),
+ PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395),
+// PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), // HermesI
+// PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), // HermesI
+// PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01),
+// PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1),
+ PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1),
+// PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6),
+ PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed),
+ PCMCIA_DEVICE_PROD_ID123("PCMCIA", "11M WLAN Card v2.5", "ISL37300P", 0x281f1c5d, 0x6e440487, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264),
+ PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178),
+ PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
+ PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
+ PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
+// PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6), // Symbol24
+// PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e), // Symbol24
+ PCMCIA_DEVICE_PROD_ID123("SMC", "SMC2632W", "Version 01.02", 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
+ PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee),
PCMCIA_DEVICE_NULL
};
MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap_hw.c ./driver/modules/hostap_hw.c
--- ../hostap-driver-0.4.5/driver/modules/hostap_hw.c 2005-08-20 18:32:34.000000000 +0200
+++ ./driver/modules/hostap_hw.c 2005-11-21 13:49:16.000000000 +0100
@@ -1005,6 +1005,35 @@
return fid;
}
+static int prism2_monitor_enable(struct net_device *dev)
+{
+ if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, 5)) {
+ printk(KERN_DEBUG "Port type setting for monitor mode "
+ "failed\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hfa384x_cmd(dev, HFA384X_CMDCODE_TEST | (0x0a << 8),
+ 0, NULL, NULL)) {
+ printk(KERN_DEBUG "Could not enter testmode 0x0a\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS,
+ HFA384X_WEPFLAGS_PRIVACYINVOKED |
+ HFA384X_WEPFLAGS_HOSTENCRYPT |
+ HFA384X_WEPFLAGS_HOSTDECRYPT)) {
+ printk(KERN_DEBUG "WEP flags setting failed\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, 1)) {
+ printk(KERN_DEBUG "Could not set promiscuous mode\n");
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
static int prism2_reset_port(struct net_device *dev)
{
@@ -1028,6 +1057,10 @@
"port\n", dev->name);
}
+ if (local->iw_mode == IW_MODE_MONITOR)
+ /* force mode 0x0a after port 0 reset */
+ return prism2_monitor_enable(dev);
+
/* It looks like at least some STA firmware versions reset
* fragmentation threshold back to 2346 after enable command. Restore
* the configured value, if it differs from this default. */
@@ -1444,6 +1477,10 @@
return 1;
}
+ if (local->iw_mode == IW_MODE_MONITOR)
+ /* force mode 0x0a after port 0 reset */
+ prism2_monitor_enable(dev);
+
local->hw_ready = 1;
local->hw_reset_tries = 0;
local->hw_resetting = 0;
@@ -3260,6 +3297,7 @@
local->func->hw_config = prism2_hw_config;
local->func->hw_reset = prism2_hw_reset;
local->func->hw_shutdown = prism2_hw_shutdown;
+ local->func->monitor_enable = prism2_monitor_enable;
local->func->reset_port = prism2_reset_port;
local->func->schedule_reset = prism2_schedule_reset;
#ifdef PRISM2_DOWNLOAD_SUPPORT
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap_ioctl.c ./driver/modules/hostap_ioctl.c
--- ../hostap-driver-0.4.5/driver/modules/hostap_ioctl.c 2005-09-19 03:51:47.000000000 +0200
+++ ./driver/modules/hostap_ioctl.c 2005-11-21 13:49:16.000000000 +0100
@@ -1068,33 +1068,7 @@
printk(KERN_DEBUG "Enabling monitor mode\n");
hostap_monitor_set_type(local);
-
- if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE,
- HFA384X_PORTTYPE_PSEUDO_IBSS)) {
- printk(KERN_DEBUG "Port type setting for monitor mode "
- "failed\n");
- return -EOPNOTSUPP;
- }
-
- /* Host decrypt is needed to get the IV and ICV fields;
- * however, monitor mode seems to remove WEP flag from frame
- * control field */
- if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS,
- HFA384X_WEPFLAGS_HOSTENCRYPT |
- HFA384X_WEPFLAGS_HOSTDECRYPT)) {
- printk(KERN_DEBUG "WEP flags setting failed\n");
- return -EOPNOTSUPP;
- }
-
- if (local->func->reset_port(dev) ||
- local->func->cmd(dev, HFA384X_CMDCODE_TEST |
- (HFA384X_TEST_MONITOR << 8),
- 0, NULL, NULL)) {
- printk(KERN_DEBUG "Setting monitor mode failed\n");
- return -EOPNOTSUPP;
- }
-
- return 0;
+ return local->func->reset_port(dev);
}
@@ -1160,7 +1134,7 @@
local->iw_mode = *mode;
if (local->iw_mode == IW_MODE_MONITOR)
- hostap_monitor_mode_enable(local);
+ return hostap_monitor_mode_enable(local);
else if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt &&
!local->fw_encrypt_ok) {
printk(KERN_DEBUG "%s: defaulting to host-based encryption as "
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap_pci.c ./driver/modules/hostap_pci.c
--- ../hostap-driver-0.4.5/driver/modules/hostap_pci.c 2005-09-17 23:05:08.000000000 +0200
+++ ./driver/modules/hostap_pci.c 2005-11-21 13:56:48.000000000 +0100
@@ -48,6 +48,8 @@
{ 0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID },
/* Samsung MagicLAN SWL-2210P */
{ 0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID },
+ /* NETGEAR MA311 */
+ { 0x1385, 0x3872, PCI_ANY_ID, PCI_ANY_ID },
{ 0 }
};
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap_plx.c ./driver/modules/hostap_plx.c
--- ../hostap-driver-0.4.5/driver/modules/hostap_plx.c 2005-09-17 23:05:08.000000000 +0200
+++ ./driver/modules/hostap_plx.c 2005-11-21 16:24:11.000000000 +0100
@@ -98,6 +98,7 @@
{ 0xc250, 0x0002 } /* EMTAC A2424i */,
{ 0xd601, 0x0002 } /* Z-Com XI300 */,
{ 0xd601, 0x0005 } /* Zcomax XI-325H 200mW */,
+ { 0xd601, 0x0010 } /* Zcomax XI-325H 100mW */,
{ 0, 0}
};
diff -ur ../hostap-driver-0.4.5/driver/modules/hostap_wlan.h ./driver/modules/hostap_wlan.h
--- ../hostap-driver-0.4.5/driver/modules/hostap_wlan.h 2005-08-06 19:55:14.000000000 +0200
+++ ./driver/modules/hostap_wlan.h 2005-11-21 13:49:16.000000000 +0100
@@ -591,6 +591,7 @@
int (*hw_config)(struct net_device *dev, int initial);
void (*hw_reset)(struct net_device *dev);
void (*hw_shutdown)(struct net_device *dev, int no_disable);
+ int (*monitor_enable)(struct net_device *dev);
int (*reset_port)(struct net_device *dev);
void (*schedule_reset)(local_info_t *local);
int (*download)(local_info_t *local, |
Patch | aircrack-ng/patches/old/hostap-kernel-2.6.16.patch | diff -ur hostap/hostap_80211_tx.c hostap-aircrack-ng/hostap_80211_tx.c
--- hostap/hostap_80211_tx.c 2006-03-29 01:25:40.000000000 -0500
+++ hostap-aircrack-ng/hostap_80211_tx.c 2006-04-02 00:32:25.000000000 -0500
@@ -69,6 +69,9 @@
iface = netdev_priv(dev);
local = iface->local;
+ if (local->iw_mode == IW_MODE_MONITOR)
+ goto xmit;
+
if (skb->len < ETH_HLEN) {
printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb "
"(len=%d)\n", dev->name, skb->len);
@@ -234,6 +237,7 @@
memcpy(skb_put(skb, ETH_ALEN), &hdr.addr4, ETH_ALEN);
}
+xmit:
iface->stats.tx_packets++;
iface->stats.tx_bytes += skb->len;
@@ -404,8 +408,6 @@
}
if (skb->len < 24) {
- printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb "
- "(len=%d)\n", dev->name, skb->len);
ret = 0;
iface->stats.tx_dropped++;
goto fail;
diff -ur hostap/hostap_cs.c hostap-aircrack-ng/hostap_cs.c
--- hostap/hostap_cs.c 2006-03-29 01:25:40.000000000 -0500
+++ hostap-aircrack-ng/hostap_cs.c 2006-04-02 00:53:07.000000000 -0500
@@ -872,58 +872,105 @@
}
static struct pcmcia_device_id hostap_cs_ids[] = {
- PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
- PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
- PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
- PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
- PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
- PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
- PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
- PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
- PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
- PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
- PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
+ PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), // SonicWALL Long Range Wireless Card
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7110), // D-Link DWL-650 rev P 802.11b WLAN card
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), // Sohoware NCP110, Philips 802.11b
+// PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001), // Intel PRO/Wireless 2011 (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), // AnyPoint(TM) Wireless II PC Card
+ PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), // 3Com AirConnect PCI 777A
+ PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), // PROXIM RangeLAN-DS/LAN PC CARD
+ PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), // Compaq WL100 11 Mbps Wireless Adapter
+// PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), // Mostly Lucent Orinoco (HermesI), but also some Prism2 :(
+// PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), // Ericsson WLAN Card C11 (Symbol24)
+// PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), // Nortel eMobility 802.11 Wireless Adapter (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), // Intermec MobileLAN 11Mbps 802.11b WLAN Card
+ PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), // Samsung SWL2000-N 11Mb/s WLAN Card
+// PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), // AirWay 802.11 Adapter (HermesI)
+// PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), // ARtem Onair (HermesI)
+// PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), // Symbol Technologies LA4111 (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), // Buffalo WLI-PCM-S11
+ PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), // Linksys WPC11 Version 2.5
+ PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), // Linksys WPC11 Version 3
+ PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), // Compaq HNW-100 11 Mbps Wireless Adapter
+ PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), // Linksys WCF12 11Mbps 802.11b WLAN Card (Prism 3)
+ PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), // ASUS SpaceLink WL-100
+ PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), // SpeedStream SS1021 Wireless Adapter
+ PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x3021), // SpeedStream SS1021 Wireless Adapter (newer)
+ PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001), // Microsoft Wireless Notebook Adapter MN-520
+ PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), // PLANEX RoadLannerWave GW-NS11H
+ PCMCIA_DEVICE_MANF_CARD(0x1668, 0x0101), // ActionTec 802CI2/HCW01170-01
+ PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001), // Airvast ?
+ PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), // Airvast WN-100
+ PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), // Adaptec Ultra Wireless ANW-8030
+ PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), // CONTEC FLEXSCAN/FX-DDS110-PCC
+ PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), // Corega KK Wireless LAN PCC-11
+ PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), // Conceptronic CON11Cpro, EMTAC A2424i
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), // Safeway 802.11b, ZCOMAX AirRunner/XI-300
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), // D-Link DCF660, ZCOMAX XI-325HP 200mw
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), // SMC2532W-B V2
+
+ PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
+
PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
0x74c5e40d),
PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
0x4b801a17),
- PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
- 0x7a954bd9, 0x74be00c6),
- PCMCIA_DEVICE_PROD_ID1234(
- "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P",
- "Eval-RevA",
- 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
- PCMCIA_DEVICE_PROD_ID123(
- "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
- 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
- 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "Instant Wireless ", " Network PC CARD", "Version 01.02",
- 0x11d901af, 0x6e9bd926, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "SMC", "SMC2632W", "Version 01.02",
- 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G",
- 0x2decece3, 0x82067c18),
- PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
- 0x54f7c49c, 0x15a75e5b),
- PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
- 0x74c5e40d, 0xdb472a18),
- PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
- 0x0733cc81, 0x0c52f395),
- PCMCIA_DEVICE_PROD_ID12(
- "ZoomAir 11Mbps High", "Rate wireless Networking",
- 0x273fe3db, 0x32a1eaee),
- PCMCIA_DEVICE_NULL
+
+ PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9),
+// PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5),
+ PCMCIA_DEVICE_PROD_ID123("Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02", 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
+ PCMCIA_DEVICE_PROD_ID123("AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863", 0xea569531, 0x4bcb9645, 0x355cb092),
+ PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f),
+ PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842),
+ PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e),
+// PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb),
+// PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18),
+// PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b),
+ PCMCIA_DEVICE_PROD_ID123("corega", "WL PCCL-11", "ISL37300P", 0x0a21501a, 0x59868926, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584),
+ PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9),
+ PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac),
+ PCMCIA_DEVICE_PROD_ID123("D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02", 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
+// PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146),
+// PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
+ PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
+// PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77),
+ PCMCIA_DEVICE_PROD_ID1234("Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P", "Eval-RevA", 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
+ PCMCIA_DEVICE_PROD_ID123("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", 0x4b801a17, 0xf222ec2d, 0x630d52b2),
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
+ PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92),
+ PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395),
+// PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), // HermesI
+// PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), // HermesI
+// PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01),
+// PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1),
+ PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1),
+// PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6),
+ PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed),
+ PCMCIA_DEVICE_PROD_ID123("PCMCIA", "11M WLAN Card v2.5", "ISL37300P", 0x281f1c5d, 0x6e440487, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264),
+ PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178),
+ PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
+ PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
+ PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
+// PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6), // Symbol24
+// PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e), // Symbol24
+ PCMCIA_DEVICE_PROD_ID123("SMC", "SMC2632W", "Version 01.02", 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
+ PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee),
+ PCMCIA_DEVICE_NULL
};
MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
diff -ur hostap/hostap_hw.c hostap-aircrack-ng/hostap_hw.c
--- hostap/hostap_hw.c 2006-03-29 01:25:40.000000000 -0500
+++ hostap-aircrack-ng/hostap_hw.c 2006-04-02 00:32:25.000000000 -0500
@@ -1006,6 +1006,35 @@
return fid;
}
+static int prism2_monitor_enable(struct net_device *dev)
+{
+ if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, 5)) {
+ printk(KERN_DEBUG "Port type setting for monitor mode "
+ "failed\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hfa384x_cmd(dev, HFA384X_CMDCODE_TEST | (0x0a << 8),
+ 0, NULL, NULL)) {
+ printk(KERN_DEBUG "Could not enter testmode 0x0a\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS,
+ HFA384X_WEPFLAGS_PRIVACYINVOKED |
+ HFA384X_WEPFLAGS_HOSTENCRYPT |
+ HFA384X_WEPFLAGS_HOSTDECRYPT)) {
+ printk(KERN_DEBUG "WEP flags setting failed\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, 1)) {
+ printk(KERN_DEBUG "Could not set promiscuous mode\n");
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
static int prism2_reset_port(struct net_device *dev)
{
@@ -1032,6 +1061,10 @@
"port\n", dev->name);
}
+ if (local->iw_mode == IW_MODE_MONITOR)
+ /* force mode 0x0a after port 0 reset */
+ return prism2_monitor_enable(dev);
+
/* It looks like at least some STA firmware versions reset
* fragmentation threshold back to 2346 after enable command. Restore
* the configured value, if it differs from this default. */
@@ -1464,6 +1497,10 @@
return 1;
}
+ if (local->iw_mode == IW_MODE_MONITOR)
+ /* force mode 0x0a after port 0 reset */
+ prism2_monitor_enable(dev);
+
local->hw_ready = 1;
local->hw_reset_tries = 0;
local->hw_resetting = 0;
@@ -3146,6 +3183,7 @@
local->func->hw_config = prism2_hw_config;
local->func->hw_reset = prism2_hw_reset;
local->func->hw_shutdown = prism2_hw_shutdown;
+ local->func->monitor_enable = prism2_monitor_enable;
local->func->reset_port = prism2_reset_port;
local->func->schedule_reset = prism2_schedule_reset;
#ifdef PRISM2_DOWNLOAD_SUPPORT
diff -ur hostap/hostap_ioctl.c hostap-aircrack-ng/hostap_ioctl.c
--- hostap/hostap_ioctl.c 2006-03-29 01:25:40.000000000 -0500
+++ hostap-aircrack-ng/hostap_ioctl.c 2006-04-02 00:32:25.000000000 -0500
@@ -1104,33 +1104,7 @@
printk(KERN_DEBUG "Enabling monitor mode\n");
hostap_monitor_set_type(local);
-
- if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE,
- HFA384X_PORTTYPE_PSEUDO_IBSS)) {
- printk(KERN_DEBUG "Port type setting for monitor mode "
- "failed\n");
- return -EOPNOTSUPP;
- }
-
- /* Host decrypt is needed to get the IV and ICV fields;
- * however, monitor mode seems to remove WEP flag from frame
- * control field */
- if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS,
- HFA384X_WEPFLAGS_HOSTENCRYPT |
- HFA384X_WEPFLAGS_HOSTDECRYPT)) {
- printk(KERN_DEBUG "WEP flags setting failed\n");
- return -EOPNOTSUPP;
- }
-
- if (local->func->reset_port(dev) ||
- local->func->cmd(dev, HFA384X_CMDCODE_TEST |
- (HFA384X_TEST_MONITOR << 8),
- 0, NULL, NULL)) {
- printk(KERN_DEBUG "Setting monitor mode failed\n");
- return -EOPNOTSUPP;
- }
-
- return 0;
+ return local->func->reset_port(dev);
}
@@ -1199,7 +1173,7 @@
local->iw_mode = *mode;
if (local->iw_mode == IW_MODE_MONITOR)
- hostap_monitor_mode_enable(local);
+ return hostap_monitor_mode_enable(local);
else if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt &&
!local->fw_encrypt_ok) {
printk(KERN_DEBUG "%s: defaulting to host-based encryption as "
diff -ur hostap/hostap_main.c hostap-aircrack-ng/hostap_main.c
--- hostap/hostap_main.c 2006-03-29 01:25:40.000000000 -0500
+++ hostap-aircrack-ng/hostap_main.c 2006-04-02 00:32:25.000000000 -0500
@@ -332,7 +332,7 @@
if (local->iw_mode == IW_MODE_REPEAT)
return HFA384X_PORTTYPE_WDS;
if (local->iw_mode == IW_MODE_MONITOR)
- return HFA384X_PORTTYPE_PSEUDO_IBSS;
+ return 5; /*HFA384X_PORTTYPE_PSEUDO_IBSS;*/
return HFA384X_PORTTYPE_HOSTAP;
}
diff -ur hostap/hostap_pci.c hostap/hostap_pci.c
--- hostap/hostap_pci.c 2006-03-29 01:25:40.000000000 -0500
+++ hostap-aircrack-ng/hostap_pci.c 2006-04-02 00:32:25.000000000 -0500
@@ -49,6 +49,8 @@
{ 0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID },
/* Samsung MagicLAN SWL-2210P */
{ 0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID },
+ /* NETGEAR MA311 */
+ { 0x1385, 0x3872, PCI_ANY_ID, PCI_ANY_ID },
{ 0 }
};
diff -ur hostap/hostap_plx.c hostap/hostap_plx.c
--- hostap/hostap_plx.c 2006-03-29 01:25:40.000000000 -0500
+++ hostap-aircrack-ng/hostap_plx.c 2006-04-02 00:32:25.000000000 -0500
@@ -100,6 +100,7 @@
{ 0xc250, 0x0002 } /* EMTAC A2424i */,
{ 0xd601, 0x0002 } /* Z-Com XI300 */,
{ 0xd601, 0x0005 } /* Zcomax XI-325H 200mW */,
+ { 0xd601, 0x0010 } /* Zcomax XI-325H 100mW */,
{ 0, 0}
};
diff -ur hostap/hostap_wlan.h hostap/hostap_wlan.h
--- hostap/hostap_wlan.h 2006-03-29 01:25:40.000000000 -0500
+++ hostap-aircrack-ng/hostap_wlan.h 2006-04-02 00:32:25.000000000 -0500
@@ -575,6 +575,7 @@
int (*hw_config)(struct net_device *dev, int initial);
void (*hw_reset)(struct net_device *dev);
void (*hw_shutdown)(struct net_device *dev, int no_disable);
+ int (*monitor_enable)(struct net_device *dev);
int (*reset_port)(struct net_device *dev);
void (*schedule_reset)(local_info_t *local);
int (*download)(local_info_t *local, |
Patch | aircrack-ng/patches/old/hostap-kernel-2.6.17.patch | diff -ur linux-2.6.17.6/drivers/net/wireless/hostap/hostap_80211_tx.c linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_80211_tx.c
--- linux-2.6.17.6/drivers/net/wireless/hostap/hostap_80211_tx.c 2006-07-15 15:00:43.000000000 -0400
+++ linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_80211_tx.c 2006-07-15 23:35:27.000000000 -0400
@@ -69,6 +69,9 @@
iface = netdev_priv(dev);
local = iface->local;
+ if (local->iw_mode == IW_MODE_MONITOR)
+ goto xmit;
+
if (skb->len < ETH_HLEN) {
printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb "
"(len=%d)\n", dev->name, skb->len);
@@ -234,6 +237,7 @@
memcpy(skb_put(skb, ETH_ALEN), &hdr.addr4, ETH_ALEN);
}
+xmit:
iface->stats.tx_packets++;
iface->stats.tx_bytes += skb->len;
@@ -404,8 +408,6 @@
}
if (skb->len < 24) {
- printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb "
- "(len=%d)\n", dev->name, skb->len);
ret = 0;
iface->stats.tx_dropped++;
goto fail;
diff -ur linux-2.6.17.6/drivers/net/wireless/hostap/hostap_cs.c linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_cs.c
--- linux-2.6.17.6/drivers/net/wireless/hostap/hostap_cs.c 2006-07-15 15:00:43.000000000 -0400
+++ linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_cs.c 2006-07-15 23:35:27.000000000 -0400
@@ -830,58 +830,105 @@
}
static struct pcmcia_device_id hostap_cs_ids[] = {
- PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
- PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
- PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
- PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
- PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
- PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
- PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
- PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
- PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
- PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
- PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
- PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
+ PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), // SonicWALL Long Range Wireless Card
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7110), // D-Link DWL-650 rev P 802.11b WLAN card
+ PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), // Sohoware NCP110, Philips 802.11b
+// PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001), // Intel PRO/Wireless 2011 (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), // AnyPoint(TM) Wireless II PC Card
+ PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), // 3Com AirConnect PCI 777A
+ PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), // PROXIM RangeLAN-DS/LAN PC CARD
+ PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), // Compaq WL100 11 Mbps Wireless Adapter
+// PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), // Mostly Lucent Orinoco (HermesI), but also some Prism2 :(
+// PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), // Ericsson WLAN Card C11 (Symbol24)
+// PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), // Nortel eMobility 802.11 Wireless Adapter (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), // Intermec MobileLAN 11Mbps 802.11b WLAN Card
+ PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), // Samsung SWL2000-N 11Mb/s WLAN Card
+// PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), // AirWay 802.11 Adapter (HermesI)
+// PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), // ARtem Onair (HermesI)
+// PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), // Symbol Technologies LA4111 (Symbol24)
+ PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), // Buffalo WLI-PCM-S11
+ PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), // Linksys WPC11 Version 2.5
+ PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), // Linksys WPC11 Version 3
+ PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), // Compaq HNW-100 11 Mbps Wireless Adapter
+ PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), // Linksys WCF12 11Mbps 802.11b WLAN Card (Prism 3)
+ PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), // ASUS SpaceLink WL-100
+ PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), // SpeedStream SS1021 Wireless Adapter
+ PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x3021), // SpeedStream SS1021 Wireless Adapter (newer)
+ PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001), // Microsoft Wireless Notebook Adapter MN-520
+ PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), // PLANEX RoadLannerWave GW-NS11H
+ PCMCIA_DEVICE_MANF_CARD(0x1668, 0x0101), // ActionTec 802CI2/HCW01170-01
+ PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001), // Airvast ?
+ PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), // Airvast WN-100
+ PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), // Adaptec Ultra Wireless ANW-8030
+ PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), // CONTEC FLEXSCAN/FX-DDS110-PCC
+ PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), // Corega KK Wireless LAN PCC-11
+ PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), // Conceptronic CON11Cpro, EMTAC A2424i
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), // Safeway 802.11b, ZCOMAX AirRunner/XI-300
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), // D-Link DCF660, ZCOMAX XI-325HP 200mw
+ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), // SMC2532W-B V2
+
+ PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
+
PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
0x74c5e40d),
PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
0x4b801a17),
- PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
- 0x7a954bd9, 0x74be00c6),
- PCMCIA_DEVICE_PROD_ID1234(
- "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P",
- "Eval-RevA",
- 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
- PCMCIA_DEVICE_PROD_ID123(
- "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
- 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
- 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "Instant Wireless ", " Network PC CARD", "Version 01.02",
- 0x11d901af, 0x6e9bd926, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID123(
- "SMC", "SMC2632W", "Version 01.02",
- 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
- PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G",
- 0x2decece3, 0x82067c18),
- PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
- 0x54f7c49c, 0x15a75e5b),
- PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
- 0x74c5e40d, 0xdb472a18),
- PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
- 0x0733cc81, 0x0c52f395),
- PCMCIA_DEVICE_PROD_ID12(
- "ZoomAir 11Mbps High", "Rate wireless Networking",
- 0x273fe3db, 0x32a1eaee),
- PCMCIA_DEVICE_NULL
+
+ PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9),
+// PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5),
+ PCMCIA_DEVICE_PROD_ID123("Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02", 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
+ PCMCIA_DEVICE_PROD_ID123("AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863", 0xea569531, 0x4bcb9645, 0x355cb092),
+ PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f),
+ PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842),
+ PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e),
+// PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb),
+// PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18),
+// PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b),
+ PCMCIA_DEVICE_PROD_ID123("corega", "WL PCCL-11", "ISL37300P", 0x0a21501a, 0x59868926, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584),
+ PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9),
+ PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac),
+ PCMCIA_DEVICE_PROD_ID123("D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02", 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
+// PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146),
+// PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
+ PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
+// PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77),
+ PCMCIA_DEVICE_PROD_ID1234("Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P", "Eval-RevA", 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
+ PCMCIA_DEVICE_PROD_ID123("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", 0x4b801a17, 0xf222ec2d, 0x630d52b2),
+ PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
+ PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92),
+ PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395),
+// PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), // HermesI
+// PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), // HermesI
+// PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01),
+// PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), // HermesI
+ PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1),
+ PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1),
+// PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767), // Symbol24
+ PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6),
+ PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed),
+ PCMCIA_DEVICE_PROD_ID123("PCMCIA", "11M WLAN Card v2.5", "ISL37300P", 0x281f1c5d, 0x6e440487, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264),
+ PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178),
+ PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
+ PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
+ PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
+// PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6), // Symbol24
+// PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e), // Symbol24
+ PCMCIA_DEVICE_PROD_ID123("SMC", "SMC2632W", "Version 01.02", 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
+ PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39),
+ PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee),
+ PCMCIA_DEVICE_NULL
};
MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
Only in linux-2.6.17.6-rawtx/drivers/net/wireless/hostap: hostap_cs.c.orig
diff -ur linux-2.6.17.6/drivers/net/wireless/hostap/hostap_hw.c linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_hw.c
--- linux-2.6.17.6/drivers/net/wireless/hostap/hostap_hw.c 2006-07-15 15:00:43.000000000 -0400
+++ linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_hw.c 2006-07-15 23:35:27.000000000 -0400
@@ -1006,6 +1006,35 @@
return fid;
}
+static int prism2_monitor_enable(struct net_device *dev)
+{
+ if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, 5)) {
+ printk(KERN_DEBUG "Port type setting for monitor mode "
+ "failed\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hfa384x_cmd(dev, HFA384X_CMDCODE_TEST | (0x0a << 8),
+ 0, NULL, NULL)) {
+ printk(KERN_DEBUG "Could not enter testmode 0x0a\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS,
+ HFA384X_WEPFLAGS_PRIVACYINVOKED |
+ HFA384X_WEPFLAGS_HOSTENCRYPT |
+ HFA384X_WEPFLAGS_HOSTDECRYPT)) {
+ printk(KERN_DEBUG "WEP flags setting failed\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, 1)) {
+ printk(KERN_DEBUG "Could not set promiscuous mode\n");
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
static int prism2_reset_port(struct net_device *dev)
{
@@ -1032,6 +1061,10 @@
"port\n", dev->name);
}
+ if (local->iw_mode == IW_MODE_MONITOR)
+ /* force mode 0x0a after port 0 reset */
+ return prism2_monitor_enable(dev);
+
/* It looks like at least some STA firmware versions reset
* fragmentation threshold back to 2346 after enable command. Restore
* the configured value, if it differs from this default. */
@@ -1464,6 +1497,10 @@
return 1;
}
+ if (local->iw_mode == IW_MODE_MONITOR)
+ /* force mode 0x0a after port 0 reset */
+ prism2_monitor_enable(dev);
+
local->hw_ready = 1;
local->hw_reset_tries = 0;
local->hw_resetting = 0;
@@ -3146,6 +3183,7 @@
local->func->hw_config = prism2_hw_config;
local->func->hw_reset = prism2_hw_reset;
local->func->hw_shutdown = prism2_hw_shutdown;
+ local->func->monitor_enable = prism2_monitor_enable;
local->func->reset_port = prism2_reset_port;
local->func->schedule_reset = prism2_schedule_reset;
#ifdef PRISM2_DOWNLOAD_SUPPORT
diff -ur linux-2.6.17.6/drivers/net/wireless/hostap/hostap_ioctl.c linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_ioctl.c
--- linux-2.6.17.6/drivers/net/wireless/hostap/hostap_ioctl.c 2006-07-15 15:00:43.000000000 -0400
+++ linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_ioctl.c 2006-07-15 23:35:27.000000000 -0400
@@ -1104,33 +1104,7 @@
printk(KERN_DEBUG "Enabling monitor mode\n");
hostap_monitor_set_type(local);
-
- if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE,
- HFA384X_PORTTYPE_PSEUDO_IBSS)) {
- printk(KERN_DEBUG "Port type setting for monitor mode "
- "failed\n");
- return -EOPNOTSUPP;
- }
-
- /* Host decrypt is needed to get the IV and ICV fields;
- * however, monitor mode seems to remove WEP flag from frame
- * control field */
- if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS,
- HFA384X_WEPFLAGS_HOSTENCRYPT |
- HFA384X_WEPFLAGS_HOSTDECRYPT)) {
- printk(KERN_DEBUG "WEP flags setting failed\n");
- return -EOPNOTSUPP;
- }
-
- if (local->func->reset_port(dev) ||
- local->func->cmd(dev, HFA384X_CMDCODE_TEST |
- (HFA384X_TEST_MONITOR << 8),
- 0, NULL, NULL)) {
- printk(KERN_DEBUG "Setting monitor mode failed\n");
- return -EOPNOTSUPP;
- }
-
- return 0;
+ return local->func->reset_port(dev);
}
@@ -1199,7 +1173,7 @@
local->iw_mode = *mode;
if (local->iw_mode == IW_MODE_MONITOR)
- hostap_monitor_mode_enable(local);
+ return hostap_monitor_mode_enable(local);
else if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt &&
!local->fw_encrypt_ok) {
printk(KERN_DEBUG "%s: defaulting to host-based encryption as "
diff -ur linux-2.6.17.6/drivers/net/wireless/hostap/hostap_main.c linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_main.c
--- linux-2.6.17.6/drivers/net/wireless/hostap/hostap_main.c 2006-07-15 15:00:43.000000000 -0400
+++ linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_main.c 2006-07-15 23:35:27.000000000 -0400
@@ -332,7 +332,7 @@
if (local->iw_mode == IW_MODE_REPEAT)
return HFA384X_PORTTYPE_WDS;
if (local->iw_mode == IW_MODE_MONITOR)
- return HFA384X_PORTTYPE_PSEUDO_IBSS;
+ return 5; /*HFA384X_PORTTYPE_PSEUDO_IBSS;*/
return HFA384X_PORTTYPE_HOSTAP;
}
diff -ur linux-2.6.17.6/drivers/net/wireless/hostap/hostap_pci.c linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_pci.c
--- linux-2.6.17.6/drivers/net/wireless/hostap/hostap_pci.c 2006-07-15 15:00:43.000000000 -0400
+++ linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_pci.c 2006-07-15 23:35:27.000000000 -0400
@@ -49,6 +49,8 @@
{ 0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID },
/* Samsung MagicLAN SWL-2210P */
{ 0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID },
+ /* NETGEAR MA311 */
+ { 0x1385, 0x3872, PCI_ANY_ID, PCI_ANY_ID },
{ 0 }
};
diff -ur linux-2.6.17.6/drivers/net/wireless/hostap/hostap_plx.c linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_plx.c
--- linux-2.6.17.6/drivers/net/wireless/hostap/hostap_plx.c 2006-07-15 15:00:43.000000000 -0400
+++ linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_plx.c 2006-07-15 23:35:27.000000000 -0400
@@ -100,6 +100,7 @@
{ 0xc250, 0x0002 } /* EMTAC A2424i */,
{ 0xd601, 0x0002 } /* Z-Com XI300 */,
{ 0xd601, 0x0005 } /* Zcomax XI-325H 200mW */,
+ { 0xd601, 0x0010 } /* Zcomax XI-325H 100mW */,
{ 0, 0}
};
diff -ur linux-2.6.17.6/drivers/net/wireless/hostap/hostap_wlan.h linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_wlan.h
--- linux-2.6.17.6/drivers/net/wireless/hostap/hostap_wlan.h 2006-07-15 15:00:43.000000000 -0400
+++ linux-2.6.17.6-rawtx/drivers/net/wireless/hostap/hostap_wlan.h 2006-07-15 23:35:27.000000000 -0400
@@ -575,6 +575,7 @@
int (*hw_config)(struct net_device *dev, int initial);
void (*hw_reset)(struct net_device *dev);
void (*hw_shutdown)(struct net_device *dev, int no_disable);
+ int (*monitor_enable)(struct net_device *dev);
int (*reset_port)(struct net_device *dev);
void (*schedule_reset)(local_info_t *local);
int (*download)(local_info_t *local, |
Patch | aircrack-ng/patches/old/ieee80211_inject.patch | diff -Naur linux-source-2.6.17-orig/net/ieee80211/ieee80211_tx.c linux-source-2.6.17-rawtx/net/ieee80211/ieee80211_tx.c
--- linux-source-2.6.17-orig/net/ieee80211/ieee80211_tx.c 2006-10-13 14:18:10.000000000 +0200
+++ linux-source-2.6.17-rawtx/net/ieee80211/ieee80211_tx.c 2007-04-09 17:07:45.000000000 +0200
@@ -291,6 +291,23 @@
goto success;
}
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ txb = ieee80211_alloc_txb(1, skb->len,
+ ieee->tx_headroom, GFP_ATOMIC);
+ if (unlikely(!txb)) {
+ printk(KERN_WARNING "%s: Could not allocate TXB\n",
+ ieee->dev->name);
+ goto failed;
+ }
+
+ txb->encrypted = 0;
+ txb->payload_size = skb->len;
+ memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
+
+ goto success;
+ }
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
crypt = ieee->crypt[ieee->tx_keyidx]; |
Patch | aircrack-ng/patches/old/ipw2200-1.1.3-inject.patch | --- ipw2200-1.1.3/ipw2200.c 2006-07-17 21:43:57.000000000 +0000
+++ ipw2200-1.1.3inject/ipw2200inject.c 2006-07-18 00:29:15.000000000 +0000
@@ -10645,9 +10645,19 @@
static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, int pri)
{
+ int i = 0;
+ int kk;
+/* for (kk=0; kk<36; kk++)
+ printk("%02X ", txb->fragments[0]->data[kk]);
+ printk("\n");
+*/
+ skb_pull(txb->fragments[0], 18+6+6);
+/* for (kk=0; kk<36; kk++)
+ printk("%02X ", txb->fragments[0]->data[kk]);
+ printk("\n");
+ */
struct ieee80211_hdr_3addrqos *hdr = (struct ieee80211_hdr_3addrqos *)
txb->fragments[0]->data;
- int i = 0;
struct tfd_frame *tfd;
#ifdef CONFIG_IPW2200_QOS
int tx_id = ipw_get_tx_queue_number(priv, pri);
@@ -10660,6 +10670,28 @@
u16 remaining_bytes;
int fc;
+// memset(hdr->addr1,0x80,18);
+ memset(hdr, 0x08,1);
+/* memset(((void*)hdr)+1,0x00,1);
+ memset(((void*)hdr)+2,0x04,1);
+ memset(((void*)hdr)+3,0x04,1);
+ memset(((void*)hdr)+4,0x00,1);
+ memset(((void*)hdr)+5,0x0f,1);
+ */
+// printk("tx_skb\n");
+char * kkk=hdr;
+for(i=4; i<0x40; i++) {
+// kkk[i]=0xff;
+}
+/* for (kk=0; kk<36; kk++)
+ printk("%02X ", txb->fragments[0]->data[kk]);
+ printk("\n");
+
+ printk("WENT\n");
+ */
+ i=0;
+
+
hdr_len = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
switch (priv->ieee->iw_mode) {
case IW_MODE_ADHOC:
@@ -10711,7 +10743,7 @@
if (likely(unicast))
tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD;
- if (txb->encrypted && !priv->ieee->host_encrypt) {
+ if (0 && txb->encrypted && !priv->ieee->host_encrypt) {
switch (priv->ieee->sec.level) {
case SEC_LEVEL_3:
tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= |
Patch | aircrack-ng/patches/old/linux-wlan-0.2.3.packet.injection.patch | diff -ur linux-wlan-ng-0.2.3/src/p80211/p80211netdev.c linux-wlan-ng-0.2.3-patched/src/p80211/p80211netdev.c
--- linux-wlan-ng-0.2.3/src/p80211/p80211netdev.c 2005-10-31 14:54:59.000000000 -0500
+++ linux-wlan-ng-0.2.3-patched/src/p80211/p80211netdev.c 2006-03-16 16:33:03.000000000 -0500
@@ -511,7 +511,7 @@
* and return success .
* TODO: we need a saner way to handle this
*/
- if(skb->protocol != ETH_P_80211_RAW) {
+ if(skb->protocol != htons(ETH_P_80211_RAW)) {
p80211netdev_start_queue(wlandev);
WLAN_LOG_NOTICE(
"Tx attempt prior to association, frame dropped.\n");
@@ -523,7 +523,7 @@
}
/* Check for raw transmits */
- if(skb->protocol == ETH_P_80211_RAW) {
+ if(skb->protocol == htons(ETH_P_80211_RAW)) {
if (!capable(CAP_NET_ADMIN)) {
result = 1;
goto failed;
@@ -950,8 +950,9 @@
dev->set_mac_address = p80211knetdev_set_mac_address;
#endif
#ifdef HAVE_TX_TIMEOUT
- dev->tx_timeout = &p80211knetdev_tx_timeout;
- dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000;
+// korek: still not implemented
+// dev->tx_timeout = &p80211knetdev_tx_timeout;
+// dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000;
#endif
netif_carrier_off(dev);
}
diff -ur linux-wlan-ng-0.2.3/src/prism2/driver/hfa384x.c linux-wlan-ng-0.2.3-patched/src/prism2/driver/hfa384x.c
--- linux-wlan-ng-0.2.3/src/prism2/driver/hfa384x.c 2005-07-20 11:07:16.000000000 -0400
+++ linux-wlan-ng-0.2.3-patched/src/prism2/driver/hfa384x.c 2006-03-17 11:03:09.000000000 -0500
@@ -1871,8 +1871,16 @@
DBFENTER;
- cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
- HFA384x_CMD_AINFO_SET(enable);
+// cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+// HFA384x_CMD_AINFO_SET(enable);
+ if (enable == HFA384x_MONITOR_ENABLE) {
+ // KoreK: get into test mode 0x0a
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(0x0a);
+ } else {
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(enable);
+ }
cmd.parm0 = 0;
cmd.parm1 = 0;
cmd.parm2 = 0;
@@ -3112,12 +3120,34 @@
#endif
/* if we're using host WEP, increase size by IV+ICV */
- if (p80211_wep->data) {
- txdesc.data_len = host2hfa384x_16(skb->len+8);
- // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
- } else {
- txdesc.data_len = host2hfa384x_16(skb->len);
- }
+// if (p80211_wep->data) {
+// txdesc.data_len = host2hfa384x_16(skb->len+8);
+// // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+// } else {
+// txdesc.data_len = host2hfa384x_16(skb->len);
+// }
+
+ if (skb->protocol != htons(ETH_P_80211_RAW)) {
+ /* if we're using host WEP, increase size by IV+ICV */
+ if (p80211_wep->data) {
+ txdesc.data_len = host2hfa384x_16(skb->len+8);
+ // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+ } else {
+ txdesc.data_len = host2hfa384x_16(skb->len);
+ }
+ } else {
+ /* KoreK: raw injection (monitor mode): pull the rest of
+ the header and ssanity check on txdesc.data_len */
+ memcpy(&(txdesc.data_len), skb->data, 16);
+ skb_pull(skb,16);
+ if (txdesc.data_len != host2hfa384x_16(skb->len)) {
+ printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
+ return 0;
+ }
+
+ txdesc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
+ }
+
txdesc.tx_control = host2hfa384x_16(txdesc.tx_control);
/* copy the header over to the txdesc */
@@ -3140,7 +3170,9 @@
spin_lock(&hw->cmdlock);
/* Copy descriptor+payload to FID */
- if (p80211_wep->data) {
+
+// if (p80211_wep->data) {
+ if (p80211_wep->data && (skb->protocol != htons(ETH_P_80211_RAW))) {
result = hfa384x_copy_to_bap4(hw, HFA384x_BAP_PROC, fid, 0,
&txdesc, sizeof(txdesc),
p80211_wep->iv, sizeof(p80211_wep->iv),
@@ -3586,6 +3618,17 @@
{
case 0:
+ /* KoreK: this testmode uses macport 0 */
+ if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
+ (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
+ if ( ! HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) ) {
+ hfa384x_int_rxmonitor( wlandev, rxfid, &rxdesc);
+ } else {
+ WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
+ }
+ goto done;
+ }
+
fc = ieee2host16(rxdesc.frame_control);
/* If exclude and we receive an unencrypted, drop it */
diff -ur linux-wlan-ng-0.2.3/src/prism2/driver/hfa384x_usb.c linux-wlan-ng-0.2.3-patched/src/prism2/driver/hfa384x_usb.c
--- linux-wlan-ng-0.2.3/src/prism2/driver/hfa384x_usb.c 2005-10-31 14:52:36.000000000 -0500
+++ linux-wlan-ng-0.2.3-patched/src/prism2/driver/hfa384x_usb.c 2006-03-18 15:38:19.000000000 -0500
@@ -1398,8 +1398,16 @@
DBFENTER;
- cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
- HFA384x_CMD_AINFO_SET(enable);
+// cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+// HFA384x_CMD_AINFO_SET(enable);
+ if (enable == HFA384x_MONITOR_ENABLE) {
+ // KoreK: get into test mode 0x0a
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(0x0a);
+ } else {
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(enable);
+ }
cmd.parm0 = 0;
cmd.parm1 = 0;
cmd.parm2 = 0;
@@ -3412,37 +3420,71 @@
HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) |
HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0);
#endif
- hw->txbuff.txfrm.desc.tx_control =
- host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
-
- /* copy the header over to the txdesc */
- memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
+// hw->txbuff.txfrm.desc.tx_control =
+// host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
- /* if we're using host WEP, increase size by IV+ICV */
- if (p80211_wep->data) {
- hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
- // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
- usbpktlen+=8;
- } else {
- hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
+// /* copy the header over to the txdesc */
+// memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
+ if (skb->protocol != htons(ETH_P_80211_RAW)) {
+ hw->txbuff.txfrm.desc.tx_control =
+ host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+
+ /* copy the header over to the txdesc */
+ memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
+ sizeof(p80211_hdr_t));
+
+ /* if we're using host WEP, increase size by IV+ICV */
+ if (p80211_wep->data) {
+ hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
+ // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+ usbpktlen+=8;
+ } else {
+ hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
+ }
+ } else {
+ /* KoreK: raw injection (monitor mode): pull the rest of
+ the header and ssanity check on txdesc.data_len */
+ memcpy(&(hw->txbuff.txfrm.desc.data_len), skb->data, 16);
+ skb_pull(skb,16);
+ if (hw->txbuff.txfrm.desc.data_len != host2hfa384x_16(skb->len)) {
+ printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
+ return 0;
+ }
+// /* if we're using host WEP, increase size by IV+ICV */
+// if (p80211_wep->data) {
+// hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
+// // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+// usbpktlen+=8;
+// } else {
+// hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
+ hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
+ hw->txbuff.txfrm.desc.tx_control =
+ host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+
+ /* copy the header over to the txdesc */
+ memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
+ sizeof(p80211_hdr_t));
}
usbpktlen += skb->len;
/* copy over the WEP IV if we are using host WEP */
ptr = hw->txbuff.txfrm.data;
- if (p80211_wep->data) {
+// if (p80211_wep->data) {
+ if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
memcpy(ptr, p80211_wep->iv, sizeof(p80211_wep->iv));
ptr+= sizeof(p80211_wep->iv);
memcpy(ptr, p80211_wep->data, skb->len);
} else {
memcpy(ptr, skb->data, skb->len);
}
+
/* copy over the packet data */
ptr+= skb->len;
/* copy over the WEP ICV if we are using host WEP */
- if (p80211_wep->data) {
+// if (p80211_wep->data) {
+ if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
memcpy(ptr, p80211_wep->icv, sizeof(p80211_wep->icv));
}
@@ -4203,6 +4245,17 @@
switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) )
{
case 0:
+ /* KoreK: this testmode uses macport 0 */
+ if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
+ (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
+ if ( ! HFA384x_RXSTATUS_ISFCSERR(usbin->rxfrm.desc.status) ) {
+ hfa384x_int_rxmonitor(wlandev, &usbin->rxfrm);
+ } else {
+ WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
+ }
+ goto done;
+ }
+
fc = ieee2host16(usbin->rxfrm.desc.frame_control);
/* If exclude and we receive an unencrypted, drop it */
diff -ur linux-wlan-ng-0.2.3/src/prism2/driver/prism2mgmt.c linux-wlan-ng-0.2.3-patched/src/prism2/driver/prism2mgmt.c
--- linux-wlan-ng-0.2.3/src/prism2/driver/prism2mgmt.c 2005-06-22 10:16:55.000000000 -0400
+++ linux-wlan-ng-0.2.3-patched/src/prism2/driver/prism2mgmt.c 2006-03-18 15:21:03.000000000 -0500
@@ -2860,9 +2860,12 @@
}
/* Now if we're already sniffing, we can skip the rest */
- if (wlandev->netdev->type != ARPHRD_ETHER) {
+// if (wlandev->netdev->type != ARPHRD_ETHER) {
+ if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
+ (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
/* Set the port type to pIbss */
- word = HFA384x_PORTTYPE_PSUEDOIBSS;
+// word = HFA384x_PORTTYPE_PSUEDOIBSS;
+ word = 5; // HFA384x_PORTTYPE_PSUEDOIBSS;
result = hfa384x_drvr_setconfig16(hw,
HFA384x_RID_CNFPORTTYPE, word);
if ( result ) {
@@ -2874,6 +2877,8 @@
}
if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) {
/* Set the wepflags for no decryption */
+ /* doesn't work - done from the CLI */
+ /* Fix? KoreK */
word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT |
HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word);
@@ -2919,7 +2924,9 @@
goto failed;
}
- if (wlandev->netdev->type == ARPHRD_ETHER) {
+// if (wlandev->netdev->type == ARPHRD_ETHER) {
+ if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
+ (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
WLAN_LOG_INFO("monitor mode enabled\n");
}
diff -ur linux-wlan-ng-0.2.3/src/prism2/driver/prism2sta.c linux-wlan-ng-0.2.3-patched/src/prism2/driver/prism2sta.c
--- linux-wlan-ng-0.2.3/src/prism2/driver/prism2sta.c 2005-10-07 17:32:44.000000000 -0400
+++ linux-wlan-ng-0.2.3-patched/src/prism2/driver/prism2sta.c 2006-03-18 15:15:00.000000000 -0500
@@ -410,7 +410,9 @@
DBFENTER;
/* If necessary, set the 802.11 WEP bit */
- if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
+// if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
+ if (((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED)
+ && (skb->protocol != htons(ETH_P_80211_RAW))) {
p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1));
} |
Patch | aircrack-ng/patches/old/linux-wlan-0.2.5.packet.injection.patch | diff -ru linux-wlan-ng-0.2.5/src/p80211/p80211netdev.c linux-wlan-ng-0.2.5-patched/src/p80211/p80211netdev.c
--- linux-wlan-ng-0.2.5/src/p80211/p80211netdev.c 2006-08-31 15:40:47.000000000 +0200
+++ linux-wlan-ng-0.2.5-patched/src/p80211/p80211netdev.c 2007-01-05 09:34:01.000000000 +0100
@@ -511,7 +511,7 @@
* and return success .
* TODO: we need a saner way to handle this
*/
- if(skb->protocol != ETH_P_80211_RAW) {
+ if(skb->protocol != htons(ETH_P_80211_RAW)) {
p80211netdev_start_queue(wlandev);
WLAN_LOG_NOTICE(
"Tx attempt prior to association, frame dropped.\n");
@@ -523,7 +523,7 @@
}
/* Check for raw transmits */
- if(skb->protocol == ETH_P_80211_RAW) {
+ if(skb->protocol == htons(ETH_P_80211_RAW)) {
if (!capable(CAP_NET_ADMIN)) {
result = 1;
goto failed;
@@ -951,8 +951,9 @@
dev->set_mac_address = p80211knetdev_set_mac_address;
#endif
#ifdef HAVE_TX_TIMEOUT
- dev->tx_timeout = &p80211knetdev_tx_timeout;
- dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000;
+// korek: still not implemented
+// dev->tx_timeout = &p80211knetdev_tx_timeout;
+// dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000;
#endif
netif_carrier_off(dev);
}
diff -ru linux-wlan-ng-0.2.5/src/prism2/driver/hfa384x.c linux-wlan-ng-0.2.5-patched/src/prism2/driver/hfa384x.c
--- linux-wlan-ng-0.2.5/src/prism2/driver/hfa384x.c 2006-08-03 16:00:04.000000000 +0200
+++ linux-wlan-ng-0.2.5-patched/src/prism2/driver/hfa384x.c 2007-01-05 09:38:13.000000000 +0100
@@ -1871,8 +1871,16 @@
DBFENTER;
- cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
- HFA384x_CMD_AINFO_SET(enable);
+// cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+// HFA384x_CMD_AINFO_SET(enable);
+ if (enable == HFA384x_MONITOR_ENABLE) {
+ // KoreK: get into test mode 0x0a
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(0x0a);
+ } else {
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(enable);
+ }
cmd.parm0 = 0;
cmd.parm1 = 0;
cmd.parm2 = 0;
@@ -3112,12 +3120,33 @@
#endif
/* if we're using host WEP, increase size by IV+ICV */
- if (p80211_wep->data) {
- txdesc.data_len = host2hfa384x_16(skb->len+8);
- // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
- } else {
- txdesc.data_len = host2hfa384x_16(skb->len);
- }
+// if (p80211_wep->data) {
+// txdesc.data_len = host2hfa384x_16(skb->len+8);
+// // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+// } else {
+// txdesc.data_len = host2hfa384x_16(skb->len);
+// }
+
+ if (skb->protocol != htons(ETH_P_80211_RAW)) {
+ /* if we're using host WEP, increase size by IV+ICV */
+ if (p80211_wep->data) {
+ txdesc.data_len = host2hfa384x_16(skb->len+8);
+ // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+ } else {
+ txdesc.data_len = host2hfa384x_16(skb->len);
+ }
+ } else {
+ /* KoreK: raw injection (monitor mode): pull the rest of
+ the header and ssanity check on txdesc.data_len */
+ memcpy(&(txdesc.data_len), skb->data, 16);
+ skb_pull(skb,16);
+ if (txdesc.data_len != host2hfa384x_16(skb->len)) {
+ printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
+ return 0;
+ }
+
+ txdesc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
+ }
txdesc.tx_control = host2hfa384x_16(txdesc.tx_control);
/* copy the header over to the txdesc */
@@ -3140,7 +3169,8 @@
spin_lock(&hw->cmdlock);
/* Copy descriptor+payload to FID */
- if (p80211_wep->data) {
+// if (p80211_wep->data) {
+ if (p80211_wep->data && (skb->protocol != htons(ETH_P_80211_RAW))) {
result = hfa384x_copy_to_bap4(hw, HFA384x_BAP_PROC, fid, 0,
&txdesc, sizeof(txdesc),
p80211_wep->iv, sizeof(p80211_wep->iv),
@@ -3585,6 +3615,17 @@
switch( HFA384x_RXSTATUS_MACPORT_GET(rxdesc.status) )
{
case 0:
+
+ /* KoreK: this testmode uses macport 0 */
+ if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
+ (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
+ if ( ! HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) ) {
+ hfa384x_int_rxmonitor( wlandev, rxfid, &rxdesc);
+ } else {
+ WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
+ }
+ goto done;
+ }
fc = ieee2host16(rxdesc.frame_control);
diff -ru linux-wlan-ng-0.2.5/src/prism2/driver/hfa384x_usb.c linux-wlan-ng-0.2.5-patched/src/prism2/driver/hfa384x_usb.c
--- linux-wlan-ng-0.2.5/src/prism2/driver/hfa384x_usb.c 2006-04-03 18:12:03.000000000 +0200
+++ linux-wlan-ng-0.2.5-patched/src/prism2/driver/hfa384x_usb.c 2007-01-05 09:46:13.000000000 +0100
@@ -1428,8 +1428,16 @@
DBFENTER;
- cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
- HFA384x_CMD_AINFO_SET(enable);
+ // cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ // HFA384x_CMD_AINFO_SET(enable);
+ if (enable == HFA384x_MONITOR_ENABLE) {
+ // KoreK: get into test mode 0x0a
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(0x0a);
+ } else {
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(enable);
+ }
cmd.parm0 = 0;
cmd.parm1 = 0;
cmd.parm2 = 0;
@@ -3429,37 +3437,71 @@
HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) |
HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0);
#endif
- hw->txbuff.txfrm.desc.tx_control =
- host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
-
- /* copy the header over to the txdesc */
- memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
+ // hw->txbuff.txfrm.desc.tx_control =
+ // host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
- /* if we're using host WEP, increase size by IV+ICV */
- if (p80211_wep->data) {
- hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
- // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
- usbpktlen+=8;
- } else {
- hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
+ // /* copy the header over to the txdesc */
+ // memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
+ if (skb->protocol != htons(ETH_P_80211_RAW)) {
+ hw->txbuff.txfrm.desc.tx_control =
+ host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+
+ /* copy the header over to the txdesc */
+ memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
+ sizeof(p80211_hdr_t));
+
+ /* if we're using host WEP, increase size by IV+ICV */
+ if (p80211_wep->data) {
+ hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
+ // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+ usbpktlen+=8;
+ } else {
+ hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
+ }
+ } else {
+ /* KoreK: raw injection (monitor mode): pull the rest of
+ the header and ssanity check on txdesc.data_len */
+ memcpy(&(hw->txbuff.txfrm.desc.data_len), skb->data, 16);
+ skb_pull(skb,16);
+ if (hw->txbuff.txfrm.desc.data_len != host2hfa384x_16(skb->len)) {
+ printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
+ return 0;
+ }
+ // /* if we're using host WEP, increase size by IV+ICV */
+ // if (p80211_wep->data) {
+ // hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
+ // // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+ // usbpktlen+=8;
+ // } else {
+ // hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
+ hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
+ hw->txbuff.txfrm.desc.tx_control =
+ host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+
+ /* copy the header over to the txdesc */
+ memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
+ sizeof(p80211_hdr_t));
}
usbpktlen += skb->len;
/* copy over the WEP IV if we are using host WEP */
ptr = hw->txbuff.txfrm.data;
- if (p80211_wep->data) {
+ // if (p80211_wep->data) {
+ if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
memcpy(ptr, p80211_wep->iv, sizeof(p80211_wep->iv));
ptr+= sizeof(p80211_wep->iv);
memcpy(ptr, p80211_wep->data, skb->len);
} else {
memcpy(ptr, skb->data, skb->len);
}
+
/* copy over the packet data */
ptr+= skb->len;
/* copy over the WEP ICV if we are using host WEP */
- if (p80211_wep->data) {
+ // if (p80211_wep->data) {
+ if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
memcpy(ptr, p80211_wep->icv, sizeof(p80211_wep->icv));
}
@@ -4221,6 +4263,17 @@
switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) )
{
case 0:
+ /* KoreK: this testmode uses macport 0 */
+ if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
+ (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
+ if ( ! HFA384x_RXSTATUS_ISFCSERR(usbin->rxfrm.desc.status) ) {
+ hfa384x_int_rxmonitor(wlandev, &usbin->rxfrm);
+ } else {
+ WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
+ }
+ goto done;
+ }
+
fc = ieee2host16(usbin->rxfrm.desc.frame_control);
/* If exclude and we receive an unencrypted, drop it */
diff -ru linux-wlan-ng-0.2.5/src/prism2/driver/prism2mgmt.c linux-wlan-ng-0.2.5-patched/src/prism2/driver/prism2mgmt.c
--- linux-wlan-ng-0.2.5/src/prism2/driver/prism2mgmt.c 2005-06-22 16:16:55.000000000 +0200
+++ linux-wlan-ng-0.2.5-patched/src/prism2/driver/prism2mgmt.c 2007-01-05 09:49:13.000000000 +0100
@@ -2860,9 +2860,12 @@
}
/* Now if we're already sniffing, we can skip the rest */
- if (wlandev->netdev->type != ARPHRD_ETHER) {
+ // if (wlandev->netdev->type != ARPHRD_ETHER) {
+ if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
+ (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
/* Set the port type to pIbss */
- word = HFA384x_PORTTYPE_PSUEDOIBSS;
+ // word = HFA384x_PORTTYPE_PSUEDOIBSS;
+ word = 5; // HFA384x_PORTTYPE_PSUEDOIBSS;
result = hfa384x_drvr_setconfig16(hw,
HFA384x_RID_CNFPORTTYPE, word);
if ( result ) {
@@ -2874,6 +2877,8 @@
}
if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) {
/* Set the wepflags for no decryption */
+ /* doesn't work - done from the CLI */
+ /* Fix? KoreK */
word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT |
HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word);
@@ -2919,7 +2924,9 @@
goto failed;
}
- if (wlandev->netdev->type == ARPHRD_ETHER) {
+ // if (wlandev->netdev->type == ARPHRD_ETHER) {
+ if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
+ (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
WLAN_LOG_INFO("monitor mode enabled\n");
}
diff -ru linux-wlan-ng-0.2.5/src/prism2/driver/prism2sta.c linux-wlan-ng-0.2.5-patched/src/prism2/driver/prism2sta.c
--- linux-wlan-ng-0.2.5/src/prism2/driver/prism2sta.c 2006-01-19 22:25:50.000000000 +0100
+++ linux-wlan-ng-0.2.5-patched/src/prism2/driver/prism2sta.c 2007-01-05 09:49:50.000000000 +0100
@@ -410,7 +410,9 @@
DBFENTER;
/* If necessary, set the 802.11 WEP bit */
- if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
+ // if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
+ if (((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED)
+ && (skb->protocol != htons(ETH_P_80211_RAW))) {
p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1));
} |
Patch | aircrack-ng/patches/old/mac80211_2.6.26-rc6-wl_frag.patch | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 195cb6d..b7b1ee2 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -280,6 +280,10 @@ static ieee80211_tx_result
ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
+
+ if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED))
+ return TX_CONTINUE;
if (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)) >= 24)
ieee80211_include_sequence(tx->sdata, hdr); |
Patch | aircrack-ng/patches/old/mac80211_2.6.26-rc6-wl_frag_v2.patch | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 195cb6d..31aeacd 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -280,6 +280,15 @@ static ieee80211_tx_result
ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
+
+ /*
+ * don't touch sequence numbers on raw monitor interfaces
+ */
+ if (unlikely((info->flags & IEEE80211_TX_CTL_INJECTED) &&
+ (tx->sdata->vif.type == IEEE80211_IF_TYPE_MNTR) &&
+ !(tx->sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)))
+ return TX_CONTINUE;
if (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)) >= 24)
ieee80211_include_sequence(tx->sdata, hdr); |
Patch | aircrack-ng/patches/old/mac80211_2.6.28-rc4-wl_frag+ack.patch | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0855cac..221bed6 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -611,11 +611,20 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
/*
* Packet injection may want to control the sequence
- * number, if we have no matching interface then we
- * neither assign one ourselves nor ask the driver to.
+ * number, so if an injected packet is found, skip
+ * renumbering it. Also make the packet NO_ACK to avoid
+ * excessive retries (ACKing and retrying should be
+ * handled by the injecting application).
+ * FIXME This may break hostapd and some other injectors.
+ * This should be done using a radiotap flag.
*/
- if (unlikely(!info->control.vif))
+ if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED) &&
+ (tx->sdata->vif.type == IEEE80211_IF_TYPE_MNTR) &&
+ !(tx->sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)) {
+ if (!ieee80211_has_morefrags(hdr->frame_control))
+ info->flags |= IEEE80211_TX_CTL_NO_ACK;
return TX_CONTINUE;
+ }
if (unlikely(ieee80211_is_ctl(hdr->frame_control)))
return TX_CONTINUE; |
Patch | aircrack-ng/patches/old/madwifi-cvs-20050707.patch | diff -ur ../madwifi-cvs-20050707/ath/if_ath.c ./ath/if_ath.c
--- ../madwifi-cvs-20050707/ath/if_ath.c 2005-06-25 02:35:12.000000000 +0200
+++ ./ath/if_ath.c 2005-07-30 00:27:46.000000000 +0200
@@ -1117,7 +1117,8 @@
/*
* Encapsulate the packet for transmission.
*/
- skb = ieee80211_encap(ic, skb, &ni);
+ if (ic->ic_opmode != IEEE80211_M_MONITOR)
+ skb = ieee80211_encap(ic, skb, &ni);
if (skb == NULL) {
DPRINTF(sc, ATH_DEBUG_XMIT,
"%s: discard, encapsulation failure\n", __func__);
@@ -2830,7 +2831,7 @@
struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
int iswep, ismcast, keyix, hdrlen, pktlen, try0;
- u_int8_t rix, txrate, ctsrate;
+ u_int8_t rix = 0, txrate, ctsrate;
u_int8_t cix = 0xff; /* NB: silence compiler */
struct ath_desc *ds;
struct ath_txq *txq;
@@ -2847,7 +2848,7 @@
hdrlen = ieee80211_anyhdrsize(wh);
pktlen = skb->len;
- if (iswep) {
+ if (iswep && ic->ic_opmode != IEEE80211_M_MONITOR) {
const struct ieee80211_cipher *cip;
struct ieee80211_key *k;
@@ -2909,7 +2910,7 @@
* use short preamble based on the current mode and
* negotiated parameters.
*/
- if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) &&
+ if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) && ni != NULL &&
(ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE)) {
shortPreamble = AH_TRUE;
sc->sc_stats.ast_tx_shortpre++;
@@ -2924,6 +2925,11 @@
*/
switch (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) {
case IEEE80211_FC0_TYPE_MGT:
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ atype = HAL_PKT_TYPE_NORMAL;
+ txq = sc->sc_ac2q[skb->priority];
+ break;
+ }
subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
if (subtype == IEEE80211_FC0_SUBTYPE_BEACON)
atype = HAL_PKT_TYPE_BEACON;
@@ -2943,6 +2949,11 @@
txq = sc->sc_ac2q[WME_AC_VO];
break;
case IEEE80211_FC0_TYPE_CTL:
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ atype = HAL_PKT_TYPE_NORMAL;
+ txq = sc->sc_ac2q[skb->priority];
+ break;
+ }
atype = HAL_PKT_TYPE_PSPOLL; /* stop setting of duration */
rix = 0; /* XXX lowest rate */
try0 = ATH_TXMAXTRY;
@@ -2958,8 +2969,9 @@
/*
* Data frames; consult the rate control module.
*/
- ath_rate_findrate(sc, an, shortPreamble, skb->len,
- &rix, &try0, &txrate);
+ if (ic->ic_opmode != IEEE80211_M_MONITOR)
+ ath_rate_findrate(sc, an, shortPreamble, skb->len,
+ &rix, &try0, &txrate);
/*
* Default all non-QoS traffic to the background queue.
*/
@@ -2970,6 +2982,11 @@
txq = sc->sc_ac2q[WME_AC_BK];
break;
default:
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ atype = HAL_PKT_TYPE_NORMAL;
+ txq = sc->sc_ac2q[skb->priority];
+ break;
+ }
printk("%s: bogus frame type 0x%x (%s)\n", dev->name,
wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK, __func__);
/* XXX statistic */
@@ -3092,6 +3109,17 @@
txq->axq_intrcnt = 0;
}
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ int i;
+ try0 = 1; /* no retransmissions */
+ txrate = 0;
+ rt = sc->sc_rates[IEEE80211_MODE_11G];
+ for (i = 0; i < rt->rateCount; i++) {
+ if (rt->info[i].rateKbps == ic->inject_rate)
+ txrate = rt->info[i].rateCode;
+ }
+ }
+
/*
* Formulate first tx descriptor with tx controls.
*/
@@ -3100,7 +3128,7 @@
, pktlen /* packet length */
, hdrlen /* header length */
, atype /* Atheros packet type */
- , MIN(ni->ni_txpower,60)/* txpower */
+ , 60 /* txpower */
, txrate, try0 /* series 0 rate/tries */
, keyix /* key cache index */
, sc->sc_txantenna /* antenna mode */
@@ -3115,7 +3143,7 @@
* when the hardware supports multi-rate retry and
* we don't use it.
*/
- if (try0 != ATH_TXMAXTRY)
+ if (try0 != ATH_TXMAXTRY && ic->ic_opmode != IEEE80211_M_MONITOR)
ath_rate_setupxtxdesc(sc, an, ds, shortPreamble, rix);
ds->ds_link = 0;
Only in ./ath: if_ath.c.orig
diff -ur ../madwifi-cvs-20050707/net80211/ieee80211_var.h ./net80211/ieee80211_var.h
--- ../madwifi-cvs-20050707/net80211/ieee80211_var.h 2005-02-16 17:09:03.000000000 +0100
+++ ./net80211/ieee80211_var.h 2005-07-29 22:43:08.000000000 +0200
@@ -307,6 +307,8 @@
*/
const struct ieee80211_aclator *ic_acl;
void *ic_as;
+
+ int inject_rate; /* injection rate in Monitor mode */
};
#define IEEE80211_ADDR_EQ(a1,a2) (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
diff -ur ../madwifi-cvs-20050707/net80211/ieee80211_wireless.c ./net80211/ieee80211_wireless.c
--- ../madwifi-cvs-20050707/net80211/ieee80211_wireless.c 2005-03-07 17:35:09.000000000 +0100
+++ ./net80211/ieee80211_wireless.c 2005-07-29 22:50:42.000000000 +0200
@@ -328,6 +328,18 @@
struct ifreq ifr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rate = rrq->value / 1000;
+ if (rate != 1000 && rate != 2000 && rate != 5500 &&
+ rate != 11000 && rate != 6000 && rate != 9000 &&
+ rate != 12000 && rate != 18000 && rate != 24000 &&
+ rate != 36000 && rate != 48000 && rate != 54000 )
+ return -EINVAL;
+ printk(KERN_DEBUG "setting xmit rate to %d\n", rate);
+ ic->inject_rate = rate;
+ return 0;
+ }
+
if (!ic->ic_media.ifm_cur)
return -EINVAL;
memset(&ifr, 0, sizeof(ifr));
@@ -354,6 +366,11 @@
struct ifmediareq imr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rrq->value = ic->inject_rate * 1000;
+ return 0;
+ }
+
memset(&imr, 0, sizeof(imr));
(*ic->ic_media.ifm_status)(ic->ic_dev, &imr);
@@ -782,6 +799,7 @@
#if WIRELESS_EXT >= 15
case IW_MODE_MONITOR:
ifr.ifr_media |= IFM_IEEE80211_MONITOR;
+ ic->inject_rate = 5500; /* default = 5.5M DSSS */
break;
#endif
default: |
Patch | aircrack-ng/patches/old/madwifi-cvs-20050814.patch | diff -ur ../madwifi-cvs-20050814/ath/if_ath.c ./ath/if_ath.c
--- ../madwifi-cvs-20050814/ath/if_ath.c 2005-08-08 02:35:12.000000000 +0200
+++ ./ath/if_ath.c 2005-08-14 21:31:07.000000000 +0200
@@ -1435,7 +1435,7 @@
rt = sc->sc_currates;
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
flags = HAL_TXDESC_INTREQ | HAL_TXDESC_CLRDMASK;
- try0 = ATH_TXMAXTRY;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY;
dot11Rate = 0;
ctsrate = 0;
ctsduration = 0;
@@ -1500,6 +1500,13 @@
}
}
+ if (dot11Rate == 0 && ic->ic_opmode == IEEE80211_M_MONITOR) {
+ int index = sc->sc_rixmap[ic->inject_rate / 500];
+ if (index >= 0 && index < rt->rateCount) {
+ txrate = rt->info[index].rateCode;
+ }
+ }
+
wh = (struct ieee80211_frame *) skb->data;
pktlen = skb->len + IEEE80211_CRC_LEN;
hdrlen = sizeof(struct ieee80211_frame);
diff -ur ../madwifi-cvs-20050814/Makefile.inc ./Makefile.inc
--- ../madwifi-cvs-20050814/Makefile.inc 2005-07-14 02:35:49.000000000 +0200
+++ ./Makefile.inc 2005-08-15 10:31:16.000000000 +0200
@@ -174,7 +174,7 @@
#
#ATH_RATE=$(shell find ath_rate/ -maxdepth 1 ! -name CVS ! -name ath_rate/ -type d)
ifeq ($(ATH_RATE),)
-ATH_RATE=ath_rate/sample
+ATH_RATE=ath_rate/onoe
endif
INCS= -include ${obj}/${DEPTH}/include/compat.h -I${obj}/${DEPTH}/include
diff -ur ../madwifi-cvs-20050814/net80211/ieee80211_crypto.c ./net80211/ieee80211_crypto.c
--- ../madwifi-cvs-20050814/net80211/ieee80211_crypto.c 2005-07-13 02:35:12.000000000 +0200
+++ ./net80211/ieee80211_crypto.c 2005-08-15 13:54:21.000000000 +0200
@@ -299,6 +299,10 @@
oflags = key->wk_flags;
flags &= IEEE80211_KEY_COMMON;
+
+ if (cipher == IEEE80211_CIPHER_WEP)
+ flags |= IEEE80211_KEY_SWCRYPT;
+
/*
* If the hardware does not support the cipher then
* fallback to a host-based implementation.
diff -ur ../madwifi-cvs-20050814/net80211/ieee80211_var.h ./net80211/ieee80211_var.h
--- ../madwifi-cvs-20050814/net80211/ieee80211_var.h 2005-07-16 02:35:11.000000000 +0200
+++ ./net80211/ieee80211_var.h 2005-08-14 21:16:37.000000000 +0200
@@ -207,6 +207,8 @@
struct timer_list ic_radar_reanimate; /* reanimation timer after stopping all channels after redar detection */
u_int32_t ic_channelList[IEEE80211_CHAN_MAX];
+
+ int inject_rate; /* injection rate in Monitor mode */
};
#define IEEE80211_ADDR_EQ(a1,a2) (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
diff -ur ../madwifi-cvs-20050814/net80211/ieee80211_wireless.c ./net80211/ieee80211_wireless.c
--- ../madwifi-cvs-20050814/net80211/ieee80211_wireless.c 2005-08-07 02:35:13.000000000 +0200
+++ ./net80211/ieee80211_wireless.c 2005-08-14 21:15:51.000000000 +0200
@@ -476,6 +476,18 @@
struct ifreq ifr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rate = rrq->value / 1000;
+ if (rate != 1000 && rate != 2000 && rate != 5500 &&
+ rate != 11000 && rate != 6000 && rate != 9000 &&
+ rate != 12000 && rate != 18000 && rate != 24000 &&
+ rate != 36000 && rate != 48000 && rate != 54000 )
+ return -EINVAL;
+ printk(KERN_DEBUG "setting xmit rate to %d\n", rate);
+ ic->inject_rate = rate;
+ return 0;
+ }
+
if (!ic->ic_media.ifm_cur)
return -EINVAL;
memset(&ifr, 0, sizeof(ifr));
@@ -502,6 +514,11 @@
struct ifmediareq imr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rrq->value = ic->inject_rate * 1000;
+ return 0;
+ }
+
memset(&imr, 0, sizeof(imr));
(*ic->ic_media.ifm_status)(ic->ic_dev, &imr);
@@ -942,6 +959,7 @@
#if WIRELESS_EXT >= 15
case IW_MODE_MONITOR:
ifr.ifr_media |= IFM_IEEE80211_MONITOR;
+ ic->inject_rate = 5500; /* default = 5.5M CCK */
break;
#endif
default: |
Patch | aircrack-ng/patches/old/madwifi-cvs-20051025.patch | diff -ur ../madwifi-cvs-20051025/Makefile.inc ./Makefile.inc
--- ../madwifi-cvs-20051025/Makefile.inc 2005-10-18 06:27:01.000000000 +0200
+++ ./Makefile.inc 2005-10-25 15:13:24.000000000 +0200
@@ -191,7 +191,7 @@
#
#ATH_RATE=$(shell find ath_rate/ -maxdepth 1 ! -name CVS ! -name ath_rate/ -type d)
ifeq ($(ATH_RATE),)
-ATH_RATE=ath_rate/sample
+ATH_RATE=ath_rate/onoe
endif
INCS= -include ${obj}/${DEPTH}/include/compat.h -I${obj}/${DEPTH}/include
Only in .: Makefile.inc.orig
diff -ur ../madwifi-cvs-20051025/ath/if_ath.c ./ath/if_ath.c
--- ../madwifi-cvs-20051025/ath/if_ath.c 2005-10-19 06:27:51.000000000 +0200
+++ ./ath/if_ath.c 2005-10-25 15:13:24.000000000 +0200
@@ -1436,7 +1436,7 @@
rt = sc->sc_currates;
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
flags = HAL_TXDESC_INTREQ | HAL_TXDESC_CLRDMASK;
- try0 = ATH_TXMAXTRY;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY;
dot11Rate = 0;
ctsrate = 0;
ctsduration = 0;
@@ -1501,6 +1501,13 @@
}
}
+ if (dot11Rate == 0 && ic->ic_opmode == IEEE80211_M_MONITOR) {
+ int index = sc->sc_rixmap[ic->inject_rate / 500];
+ if (index >= 0 && index < rt->rateCount) {
+ txrate = rt->info[index].rateCode;
+ }
+ }
+
wh = (struct ieee80211_frame *) skb->data;
pktlen = skb->len + IEEE80211_CRC_LEN;
hdrlen = sizeof(struct ieee80211_frame);
Only in ./ath: if_ath.c.orig
diff -ur ../madwifi-cvs-20051025/ath/if_ath_pci.c ./ath/if_ath_pci.c
--- ../madwifi-cvs-20051025/ath/if_ath_pci.c 2005-07-11 15:23:53.000000000 +0200
+++ ./ath/if_ath_pci.c 2005-10-25 15:15:18.000000000 +0200
@@ -100,12 +100,16 @@
{ 0xa727, 0x0013, PCI_ANY_ID, PCI_ANY_ID }, /* 3com */
{ 0x10b7, 0x0013, PCI_ANY_ID, PCI_ANY_ID }, /* 3com 3CRDAG675 */
{ 0x168c, 0x1014, PCI_ANY_ID, PCI_ANY_ID }, /* IBM minipci 5212 */
+ { 0x168c, 0x101a, PCI_ANY_ID, PCI_ANY_ID }, /* some Griffin-Lite */
{ 0x168c, 0x0015, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0016, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0017, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0018, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x0019, PCI_ANY_ID, PCI_ANY_ID },
{ 0x168c, 0x001a, PCI_ANY_ID, PCI_ANY_ID },
+ { 0x168c, 0x001b, PCI_ANY_ID, PCI_ANY_ID },
+ { 0x168c, 0x001c, PCI_ANY_ID, PCI_ANY_ID }, /* PCI Express 5424 */
+ { 0x168c, 0x001d, PCI_ANY_ID, PCI_ANY_ID }, /* PCI Express ??? */
{ 0 }
};
diff -ur ../madwifi-cvs-20051025/net80211/ieee80211_crypto.c ./net80211/ieee80211_crypto.c
--- ../madwifi-cvs-20051025/net80211/ieee80211_crypto.c 2005-07-12 13:53:38.000000000 +0200
+++ ./net80211/ieee80211_crypto.c 2005-10-25 15:13:24.000000000 +0200
@@ -299,6 +299,10 @@
oflags = key->wk_flags;
flags &= IEEE80211_KEY_COMMON;
+
+ if (cipher == IEEE80211_CIPHER_WEP)
+ flags |= IEEE80211_KEY_SWCRYPT;
+
/*
* If the hardware does not support the cipher then
* fallback to a host-based implementation.
diff -ur ../madwifi-cvs-20051025/net80211/ieee80211_var.h ./net80211/ieee80211_var.h
--- ../madwifi-cvs-20051025/net80211/ieee80211_var.h 2005-10-18 06:27:01.000000000 +0200
+++ ./net80211/ieee80211_var.h 2005-10-25 15:13:24.000000000 +0200
@@ -212,6 +212,8 @@
struct net_device *ic_wdsdev[IEEE80211_WDS_MAXNODES];
/* only wds traffic is allowed */
int ic_wdsonly;
+
+ int inject_rate; /* injection rate in Monitor mode */
};
#define IEEE80211_ADDR_EQ(a1,a2) (memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)
Only in ./net80211: ieee80211_var.h.orig
diff -ur ../madwifi-cvs-20051025/net80211/ieee80211_wireless.c ./net80211/ieee80211_wireless.c
--- ../madwifi-cvs-20051025/net80211/ieee80211_wireless.c 2005-10-18 06:27:01.000000000 +0200
+++ ./net80211/ieee80211_wireless.c 2005-10-25 15:13:24.000000000 +0200
@@ -476,6 +476,18 @@
struct ifreq ifr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rate = rrq->value / 1000;
+ if (rate != 1000 && rate != 2000 && rate != 5500 &&
+ rate != 11000 && rate != 6000 && rate != 9000 &&
+ rate != 12000 && rate != 18000 && rate != 24000 &&
+ rate != 36000 && rate != 48000 && rate != 54000 )
+ return -EINVAL;
+ printk(KERN_DEBUG "setting xmit rate to %d\n", rate);
+ ic->inject_rate = rate;
+ return 0;
+ }
+
if (!ic->ic_media.ifm_cur)
return -EINVAL;
memset(&ifr, 0, sizeof(ifr));
@@ -502,6 +514,11 @@
struct ifmediareq imr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rrq->value = ic->inject_rate * 1000;
+ return 0;
+ }
+
memset(&imr, 0, sizeof(imr));
(*ic->ic_media.ifm_status)(ic->ic_dev, &imr);
@@ -942,6 +959,7 @@
#if WIRELESS_EXT >= 15
case IW_MODE_MONITOR:
ifr.ifr_media |= IFM_IEEE80211_MONITOR;
+ ic->inject_rate = 5500; /* default = 5.5M CCK */
break;
#endif
default: |
Patch | aircrack-ng/patches/old/madwifi-ng-r1457-1473_disable_retry_raw.patch | diff -Nurb madwifi-ng-r1457/ath/if_ath.c patched_madwifi-ng-r1457/ath/if_ath.c
--- madwifi-ng-r1457/ath/if_ath.c 2006-02-25 00:24:30.000000000 +0100
+++ patched_madwifi-ng-r1457/ath/if_ath.c 2006-03-01 23:23:32.000000000 +0100
@@ -2166,6 +2166,7 @@
struct ath_softc *sc = dev->priv;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
+ struct ieee80211com *ic = &sc->sc_ic;
const HAL_RATE_TABLE *rt;
int pktlen;
int hdrlen;
@@ -2180,9 +2181,12 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ATH_TXMAXTRY;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the card waits for acknowledges...
+ */
rt = sc->sc_currates;
- txrate = dot11_to_ratecode(sc, rt, ph->rate0);
+ txrate = dot11_to_ratecode(sc, rt, (ic->ic_opmode == IEEE80211_M_MONITOR) ? (ic->inject_rate / 500) : ph->rate0);
power = ph->power > 60 ? 60 : ph->power;
hdrlen = ieee80211_anyhdrsize(wh);
pktlen = skb->len + IEEE80211_CRC_LEN;
diff -Nurb madwifi-ng-r1457/net80211/ieee80211_var.h patched_madwifi-ng-r1457/net80211/ieee80211_var.h
--- madwifi-ng-r1457/net80211/ieee80211_var.h 2006-02-06 20:58:08.000000000 +0100
+++ patched_madwifi-ng-r1457/net80211/ieee80211_var.h 2006-03-01 23:24:38.000000000 +0100
@@ -138,6 +138,7 @@
u_int16_t ic_txpowlimit; /* global tx power limit */
u_int16_t ic_uapsdmaxtriggers; /* max triggers that could arrive */
u_int8_t ic_coverageclass; /* coverage class */
+ int inject_rate; /* injection rate in Monitor mode */
/*
* Channel state:
diff -Nurb madwifi-ng-r1457/net80211/ieee80211_wireless.c patched_madwifi-ng-r1457/net80211/ieee80211_wireless.c
--- madwifi-ng-r1457/net80211/ieee80211_wireless.c 2006-02-19 18:35:54.000000000 +0100
+++ patched_madwifi-ng-r1457/net80211/ieee80211_wireless.c 2006-03-01 23:30:34.000000000 +0100
@@ -346,6 +346,18 @@
struct ifmediareq imr;
int rate, retv;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rate = rrq->value / 1000;
+ if (rate != 1000 && rate != 2000 && rate != 5500 &&
+ rate != 11000 && rate != 6000 && rate != 9000 &&
+ rate != 12000 && rate != 18000 && rate != 24000 &&
+ rate != 36000 && rate != 48000 && rate != 54000 )
+ return -EINVAL;
+ printk(KERN_DEBUG "setting xmit rate to %d\n", rate);
+ ic->inject_rate = rate;
+ return 0;
+ }
+
if (vap->iv_media.ifm_cur == NULL)
return -EINVAL;
memset(&ifr, 0, sizeof(ifr));
@@ -379,9 +391,15 @@
struct iw_param *rrq, char *extra)
{
struct ieee80211vap *vap = dev->priv;
+ struct ieee80211com *ic = vap->iv_ic;
struct ifmediareq imr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rrq->value = ic->inject_rate * 1000;
+ return 0;
+ }
+
memset(&imr, 0, sizeof(imr));
vap->iv_media.ifm_status(vap->iv_dev, &imr);
@@ -1051,6 +1069,7 @@
__u32 *mode, char *extra)
{
struct ieee80211vap *vap = dev->priv;
+ struct ieee80211com *ic = vap->iv_ic;
struct ifmediareq imr;
int valid = 0;
@@ -1060,8 +1079,10 @@
if (imr.ifm_active & IFM_IEEE80211_HOSTAP)
valid = (*mode == IW_MODE_MASTER);
#if WIRELESS_EXT >= 15
- else if (imr.ifm_active & IFM_IEEE80211_MONITOR)
+ else if (imr.ifm_active & IFM_IEEE80211_MONITOR) {
valid = (*mode == IW_MODE_MONITOR);
+ ic->inject_rate = 5500; /* default = 5.5M CCK */
+ }
#endif
else if (imr.ifm_active & IFM_IEEE80211_ADHOC)
valid = (*mode == IW_MODE_ADHOC); |
Patch | aircrack-ng/patches/old/madwifi-ng-r1475_disable_retry_raw.patch | diff -Nurb madwifi-ng-r1475/ath/if_ath.c patched_madwifi-ng-r1475/ath/if_ath.c
--- madwifi-ng-r1475/ath/if_ath.c 2006-03-19 23:32:54.000000000 +0100
+++ patched_madwifi-ng-r1475/ath/if_ath.c 2006-03-19 23:23:08.000000000 +0100
@@ -2171,6 +2171,7 @@
struct ath_softc *sc = dev->priv;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
+ struct ieee80211com *ic = &sc->sc_ic;
const HAL_RATE_TABLE *rt;
int pktlen;
int hdrlen;
@@ -2185,9 +2186,13 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ATH_TXMAXTRY;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the card waits for acknowledges...
+ */
rt = sc->sc_currates;
- txrate = dot11_to_ratecode(sc, rt, ph->rate0);
+ txrate = dot11_to_ratecode(sc, rt, (ic->ic_opmode == IEEE80211_M_MONITOR) ? (ic->inject_rate / 500) : ph->rate0);
power = ph->power > 60 ? 60 : ph->power;
hdrlen = ieee80211_anyhdrsize(wh);
pktlen = skb->len + IEEE80211_CRC_LEN;
diff -Nurb madwifi-ng-r1475/net80211/ieee80211_var.h patched_madwifi-ng-r1475/net80211/ieee80211_var.h
--- madwifi-ng-r1475/net80211/ieee80211_var.h 2006-03-19 23:32:40.000000000 +0100
+++ patched_madwifi-ng-r1475/net80211/ieee80211_var.h 2006-03-19 23:24:48.000000000 +0100
@@ -138,6 +138,7 @@
u_int16_t ic_txpowlimit; /* global tx power limit */
u_int16_t ic_uapsdmaxtriggers; /* max triggers that could arrive */
u_int8_t ic_coverageclass; /* coverage class */
+ int inject_rate; /* injection rate in Monitor mode */
/*
* Channel state:
diff -Nurb madwifi-ng-r1475/net80211/ieee80211_wireless.c patched_madwifi-ng-r1475/net80211/ieee80211_wireless.c
--- madwifi-ng-r1475/net80211/ieee80211_wireless.c 2006-03-19 23:32:40.000000000 +0100
+++ patched_madwifi-ng-r1475/net80211/ieee80211_wireless.c 2006-03-19 23:30:28.000000000 +0100
@@ -346,6 +346,18 @@
struct ifmediareq imr;
int rate, retv;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rate = rrq->value / 1000;
+ if (rate != 1000 && rate != 2000 && rate != 5500 &&
+ rate != 11000 && rate != 6000 && rate != 9000 &&
+ rate != 12000 && rate != 18000 && rate != 24000 &&
+ rate != 36000 && rate != 48000 && rate != 54000 )
+ return -EINVAL;
+ printk(KERN_DEBUG "setting xmit rate to %d\n", rate);
+ ic->inject_rate = rate;
+ return 0;
+ }
+
if (vap->iv_media.ifm_cur == NULL)
return -EINVAL;
memset(&ifr, 0, sizeof(ifr));
@@ -379,9 +391,15 @@
struct iw_param *rrq, char *extra)
{
struct ieee80211vap *vap = dev->priv;
+ struct ieee80211com *ic = vap->iv_ic;
struct ifmediareq imr;
int rate;
+ if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ rrq->value = ic->inject_rate * 1000;
+ return 0;
+ }
+
memset(&imr, 0, sizeof(imr));
vap->iv_media.ifm_status(vap->iv_dev, &imr);
@@ -1051,6 +1069,7 @@
__u32 *mode, char *extra)
{
struct ieee80211vap *vap = dev->priv;
+ struct ieee80211com *ic = vap->iv_ic;
struct ifmediareq imr;
int valid = 0;
@@ -1060,8 +1079,10 @@
if (imr.ifm_active & IFM_IEEE80211_HOSTAP)
valid = (*mode == IW_MODE_MASTER);
#if WIRELESS_EXT >= 15
- else if (imr.ifm_active & IFM_IEEE80211_MONITOR)
+ else if (imr.ifm_active & IFM_IEEE80211_MONITOR) {
valid = (*mode == IW_MODE_MONITOR);
+ ic->inject_rate = 5500; /* default = 5.5M CCK */
+ }
#endif
else if (imr.ifm_active & IFM_IEEE80211_ADHOC)
valid = (*mode == IW_MODE_ADHOC); |
Patch | aircrack-ng/patches/old/madwifi-ng-r1486.patch | diff -ur madwifi-ng-r1486/ath/if_ath.c patched_madwifi-ng-r1486/ath/if_ath.c
--- madwifi-ng-r1486/ath/if_ath.c 2006-03-23 22:09:04.000000000 +0100
+++ patched_madwifi-ng-r1486/ath/if_ath.c 2006-03-28 20:59:14.000000000 +0200
@@ -2240,6 +2240,7 @@
struct ath_softc *sc = dev->priv;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
+ struct ieee80211com *ic = &sc->sc_ic;
const HAL_RATE_TABLE *rt;
int pktlen;
int hdrlen;
@@ -2254,7 +2255,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ATH_TXMAXTRY;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the card waits for acknowledges...
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1520.patch | diff -ur madwifi-ng-r1520/ath/if_ath.c patched_madwifi-ng-r1520/ath/if_ath.c
--- madwifi-ng-r1520/ath/if_ath.c 2006-04-21 18:58:34.000000000 +0200
+++ patched_madwifi-ng-r1520/ath/if_ath.c 2006-04-22 15:34:58.000000000 +0200
@@ -2247,6 +2247,7 @@
{
struct ath_softc *sc = dev->priv;
struct ath_hal *ah = sc->sc_ah;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
int pktlen;
@@ -2262,7 +2263,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ATH_TXMAXTRY;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the card waits for acknowledges...
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1526.patch | diff -ur madwifi-ng-r1527/ath/if_ath.c patched_madwifi-ng-r1527/ath/if_ath.c
--- madwifi-ng-r1527/ath/if_ath.c 2006-04-24 01:56:00.000000000 +0200
+++ patched_madwifi-ng-r1527/ath/if_ath.c 2006-04-24 18:55:24.000000000 +0200
@@ -2246,6 +2246,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2262,7 +2263,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ATH_TXMAXTRY;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ATH_TXMAXTRY;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the card waits for acknowledges...
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1545.patch | diff -ur madwifi-ng-r1545/ath/if_ath.c patched_madwifi-ng-r1545/ath/if_ath.c
--- madwifi-ng-r1545/ath/if_ath.c 2006-05-05 22:20:22.000000000 +0200
+++ patched_madwifi-ng-r1545/ath/if_ath.c 2006-05-10 19:02:00.000000000 +0200
@@ -2246,6 +2246,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2262,7 +2263,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1679.patch | diff -ur madwifi-ng-r1679/ath/if_ath.c patched_madwifi-ng-r1545/ath/if_ath.c
--- madwifi-ng-r1679/ath/if_ath.c 2006-07-04 12:23:35.000000000 +0200
+++ patched_madwifi-ng-r1679/ath/if_ath.c 2006-07-08 02:38:59.000000000 +0200
@@ -2248,6 +2248,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2264,7 +2265,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1713.patch | diff -ur madwifi-r1713/ath/if_ath.c madwifi-r1713-patched/ath/if_ath.c
--- madwifi-r1713/ath/if_ath.c 2006-09-15 20:16:39.328125000 +0200
+++ madwifi-r1713-patched/ath/if_ath.c 2006-09-16 00:47:55.140625000 +0200
@@ -2253,6 +2253,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2269,7 +2270,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1730.patch | diff -ur madwifi-r1724/ath/if_ath.c patched-madwifi-r1730/ath/if_ath.c
--- madwifi-r1724/ath/if_ath.c 2006-09-22 17:55:11.984375000 +0200
+++ patched-madwifi-r1724/ath/if_ath.c 2006-09-23 16:00:36.296875000 +0200
@@ -2258,6 +2258,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2274,7 +2275,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1754.patch | diff -ur madwifi-r1754/ath/if_ath.c patched_madwifi-r1754/ath/if_ath.c
--- madwifi-r1754/ath/if_ath.c 2006-10-17 21:32:46.812500000 +0200
+++ patched_madwifi-r1754/ath/if_ath.c 2006-10-17 21:36:20.703125000 +0200
@@ -2278,6 +2278,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2294,7 +2295,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1756.patch | diff -ur madwifi-r1756/ath/if_ath.c patched_madwifi-r1756/ath/if_ath.c
--- madwifi-r1756/ath/if_ath.c 2006-10-18 22:18:06.812500000 +0200
+++ patched_madwifi-r1756/ath/if_ath.c 2006-10-18 22:20:47.000000000 +0200
@@ -2293,6 +2293,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2309,7 +2310,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1816.patch | --- madwifi-ng-r1816-20061118/ath/if_ath.c 2006-11-09 08:28:11.000000000 +0100
+++ madwifi-ng-r1816-20061118/ath/if_ath.c.patched 2006-11-20 23:02:36.000000000 +0100
@@ -2287,6 +2287,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2303,8 +2304,12 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
- rt = sc->sc_currates;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
+ rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power;
hdrlen = ieee80211_anyhdrsize(wh); |
Patch | aircrack-ng/patches/old/madwifi-ng-r1886.patch | diff -ur madwifi-r1886/ath/if_ath.c madwifi-r1886-patched/ath/if_ath.c
--- madwifi-r1886/ath/if_ath.c 2007-01-07 21:22:55.312500000 +0100
+++ madwifi-r1886-patched/ath/if_ath.c 2007-01-07 21:17:09.875000000 +0100
@@ -2289,6 +2289,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2305,7 +2306,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r1983.patch | diff -ur madwifi-r1983/ath/if_ath.c patched-madwifi-r1983/ath/if_ath.c
--- madwifi-r1983/ath/if_ath.c 2007-01-21 00:09:36.140625000 +0100
+++ patched-madwifi-r1983/ath/if_ath.c 2007-01-21 00:11:01.984375000 +0100
@@ -2299,6 +2299,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2315,7 +2316,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power; |
Patch | aircrack-ng/patches/old/madwifi-ng-r2277.patch | diff -ur madwifi-ng/ath/if_ath.c madwifi-ng-patched/ath/if_ath.c
--- madwifi-ng/ath/if_ath.c 2007-04-14 15:42:02.000000000 +0200
+++ madwifi-ng-patched/ath/if_ath.c 2007-04-14 15:43:18.000000000 +0200
@@ -2285,6 +2285,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2298,7 +2299,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power;
Only in madwifi-ng-patched/ath: if_ath.c~ |
Patch | aircrack-ng/patches/old/madwifi-ng-r2662-dirty_wesside-ng_fix.patch | Index: ath/if_ath.c
===================================================================
--- ath/if_ath.c (revision 2662)
+++ ath/if_ath.c (working copy)
@@ -2282,6 +2282,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *) (skb->cb + sizeof(struct ieee80211_cb));
const HAL_RATE_TABLE *rt;
@@ -2294,7 +2295,11 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *) skb->data;
- try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power;
@@ -5360,18 +5365,21 @@
{
struct ath_softc *sc = dev->priv;
struct ieee80211com *ic = &sc->sc_ic;
- struct ieee80211_frame *wh = (struct ieee80211_frame *) skb->data;
- unsigned int headersize = ieee80211_anyhdrsize(wh);
- int padbytes = roundup(headersize, 4) - headersize;
+ struct ieee80211_frame *wh;
KASSERT(ic->ic_flags & IEEE80211_F_DATAPAD,
("data padding not enabled?"));
- if (padbytes > 0) {
+ wh = (struct ieee80211_frame *) skb->data;
+ if (IEEE80211_QOS_HAS_SEQ(wh)) {
+ struct sk_buff *skb1 = skb_copy(skb, GFP_ATOMIC);
/* Remove hw pad bytes */
- struct sk_buff *skb1 = skb_copy(skb, GFP_ATOMIC);
- memmove(skb1->data + padbytes, skb1->data, headersize);
- skb_pull(skb1, padbytes);
+ unsigned int headersize = ieee80211_hdrsize(wh);
+ int padbytes = roundup(headersize, 4) - headersize;
+ if (padbytes > 0) {
+ memmove(skb1->data + padbytes, skb1->data, headersize);
+ skb_pull(skb1, padbytes);
+ }
ieee80211_input_monitor(ic, skb1, bf, 0, rtsf, sc);
dev_kfree_skb(skb1);
} else {
@@ -5392,8 +5400,6 @@
A_MAX(sizeof(struct wlan_ng_prism2_header),
ATHDESC_HEADER_SIZE));
u_int32_t tstamp;
- unsigned int headersize;
- int padbytes;
/*
* release the owner of this skb since we're basically
* recycling it
@@ -5411,13 +5417,15 @@
skb_orphan(skb);
wh = (struct ieee80211_frame *) skb->data;
- headersize = ieee80211_anyhdrsize(wh);
- padbytes = roundup(headersize, 4) - headersize;
- if (padbytes > 0) {
+ if (IEEE80211_QOS_HAS_SEQ(wh)) {
/* Unlike in rx_capture, we're freeing the skb at the end
* anyway, so we don't need to worry about using a copy */
- memmove(skb->data + padbytes, skb->data, headersize);
- skb_pull(skb, padbytes);
+ unsigned int headersize = ieee80211_hdrsize(wh);
+ int padbytes = roundup(headersize, 4) - headersize;
+ if (padbytes > 0) {
+ memmove(skb->data + padbytes, skb->data, headersize);
+ skb_pull(skb, padbytes);
+ }
}
if (skb_headroom(skb) < extra && |
Patch | aircrack-ng/patches/old/madwifi-ng-r3386v3.patch | --- madwifi-ng/ath/if_ath.c 2008-03-16 20:26:53.000000000 -0400
+++ madwifi-ng_raw/ath/if_ath.c 2008-03-17 20:11:30.000000000 -0400
@@ -2875,6 +2875,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)
(SKB_CB(skb) + 1); /* NB: SKB_CB casts to CB struct*. */
@@ -2888,7 +2889,12 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *)skb->data;
- try0 = ph->try0;
+// try0 = ph->try0;
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try0;
+ /*
+ * The retry value has to be patched to 1 when injecting,
+ * otherwise the sequence number will be overwritten
+ */
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate0);
power = ph->power > 60 ? 60 : ph->power;
@@ -2913,7 +2919,7 @@
rt = sc->sc_currates;
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
- if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+ if (IEEE80211_IS_MULTICAST(wh->i_addr1) || ((ic->ic_opmode == IEEE80211_M_MONITOR) && (skb->data[1]&3) != 0x01) ) {
flags |= HAL_TXDESC_NOACK; /* no ack on broad/multicast */
sc->sc_stats.ast_tx_noack++;
try0 = 1; |
Patch | aircrack-ng/patches/old/madwifi-ng-r3745.patch | diff -Naur madwifi/ath/if_ath.c madwifi_rawtx/ath/if_ath.c
--- madwifi/ath/if_ath.c 2008-06-24 17:20:58.000000000 -0400
+++ madwifi_rawtx/ath/if_ath.c 2008-06-24 17:20:12.000000000 -0400
@@ -2950,6 +2950,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = dev->priv;
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = &(SKB_CB(skb)->phy);
const HAL_RATE_TABLE *rt;
@@ -2962,7 +2963,8 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *)skb->data;
- try0 = ph->try[0];
+// try0 = ph->try[0];
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try[0];
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate[0]);
power = ph->power > 60 ? 60 : ph->power;
@@ -2986,7 +2988,8 @@
rt = sc->sc_currates;
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
- if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+ if (IEEE80211_IS_MULTICAST(wh->i_addr1) || ((ic->ic_opmode ==
+IEEE80211_M_MONITOR) && (skb->data[1]&3) != 0x01) ) {
flags |= HAL_TXDESC_NOACK; /* no ack on broad/multicast */
sc->sc_stats.ast_tx_noack++;
try0 = 1; |
Patch | aircrack-ng/patches/old/madwifi-ng-r3925.patch | Index: ath/if_ath.c
===================================================================
--- ath/if_ath.c (revision 3925)
+++ ath/if_ath.c (working copy)
@@ -3002,6 +3002,7 @@
ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
{
struct ath_softc *sc = netdev_priv(dev);
+ struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ieee80211_phy_params *ph = &(SKB_CB(skb)->phy);
const HAL_RATE_TABLE *rt;
@@ -3014,7 +3015,8 @@
struct ieee80211_frame *wh;
wh = (struct ieee80211_frame *)skb->data;
- try0 = ph->try[0];
+// try0 = ph->try[0];
+ try0 = (ic->ic_opmode == IEEE80211_M_MONITOR) ? 1 : ph->try[0];
rt = sc->sc_currates;
txrate = dot11_to_ratecode(sc, rt, ph->rate[0]);
power = ph->power > 60 ? 60 : ph->power;
@@ -3038,7 +3040,8 @@
rt = sc->sc_currates;
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
- if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+ if (IEEE80211_IS_MULTICAST(wh->i_addr1) || ((ic->ic_opmode ==
+IEEE80211_M_MONITOR) && (skb->data[1]&3) != 0x01) ) {
flags |= HAL_TXDESC_NOACK; /* no ack on broad/multicast */
sc->sc_stats.ast_tx_noack++;
try0 = 1; |
Patch | aircrack-ng/patches/old/rt2500-cvs-20050724.patch | diff -ur ../rt2500-cvs-20050724/Module/rtmp_data.c ./Module/rtmp_data.c
--- ../rt2500-cvs-20050724/Module/rtmp_data.c 2005-07-15 17:40:02.000000000 +0200
+++ ./Module/rtmp_data.c 2005-07-26 19:04:28.000000000 +0200
@@ -2741,6 +2741,23 @@
return (NDIS_STATUS_FAILURE);
}
+ if (pAdapter->PortCfg.BssType == BSS_MONITOR)
+ {
+ pAdapter->TxRing[pAdapter->CurEncryptIndex].FrameType = BTYPE_DATA;
+ pDest = (PUCHAR) pAdapter->TxRing[pAdapter->CurEncryptIndex].va_data_addr;
+ pTxD = (PTXD_STRUC) pAdapter->TxRing[pAdapter->CurEncryptIndex].va_addr;
+ MlmeSetPsmBit(pAdapter, PWR_ACTIVE);
+ memcpy(pDest,skb->data,skb->len);
+ RTMPWriteTxDescriptor(pTxD, TRUE, CIPHER_NONE, FALSE, FALSE, FALSE, SHORT_RETRY, IFS_BACKOFF, pAdapter->PortCfg.TxRate, 4, skb->len, pAdapter->PortCfg.TxPreambleInUsed, AccessCategory);
+
+ pAdapter->CurEncryptIndex++;
+ if (pAdapter->CurEncryptIndex >= TX_RING_SIZE)
+ pAdapter->CurEncryptIndex = 0;
+ pAdapter->RalinkCounters.EncryptCount++;
+
+ goto skip_all_this_shit;
+ }
+
if (EnableTxBurst == 1)
FrameGap = IFS_SIFS;
else
@@ -2779,6 +2796,7 @@
//
// Start making 802.11 frame header
+ // this whole code is just a pathetic mess
//
memset(&Header_802_11, 0, sizeof(HEADER_802_11)); // Initialize 802.11 header for each fragment
if (INFRA_ON(pAdapter))
@@ -3411,6 +3429,7 @@
} while (NumberRequired > 0);
+skip_all_this_shit:
// Kick Encrypt Control Register at the end of all ring buffer preparation
RTMP_IO_WRITE32(pAdapter, SECCSR1, 0x1);
diff -ur ../rt2500-cvs-20050724/Module/rtmp_main.c ./Module/rtmp_main.c
--- ../rt2500-cvs-20050724/Module/rtmp_main.c 2005-07-15 17:40:02.000000000 +0200
+++ ./Module/rtmp_main.c 2005-07-26 19:03:46.000000000 +0200
@@ -354,6 +354,7 @@
DBGPRINT(RT_DEBUG_INFO, "<==== RTMPSendPackets\n");
+/*
if (pAdapter->PortCfg.BssType == BSS_MONITOR)
{
dev_kfree_skb_irq(skb);
@@ -368,7 +369,7 @@
// And Mibss for Ad-hoc mode setup
dev_kfree_skb_irq(skb);
}
- else
+ else*/
{
// This function has to manage NdisSendComplete return call within its routine
// NdisSendComplete will acknowledge upper layer in two steps. |
Patch | aircrack-ng/patches/old/rt2500-cvs-20051008-prismheader.patch | diff -ur ../rt2500-cvs-20051008/Module/rtmp_data.c ./Module/rtmp_data.c
--- ../rt2500-cvs-20051008/Module/rtmp_data.c 2005-10-06 04:53:08.000000000 +0200
+++ ./Module/rtmp_data.c 2005-11-05 01:20:02.000000000 +0100
@@ -50,6 +50,7 @@
0, /* RATE_1 */ 1, /* RATE_2 */ 2, /* RATE_5_5 */ 3, /* RATE_11 */ // see BBP spec
11, /* RATE_6 */ 15, /* RATE_9 */ 10, /* RATE_12 */ 14, /* RATE_18 */ // see IEEE802.11a-1999 p.14
9, /* RATE_24 */ 13, /* RATE_36 */ 8, /* RATE_48 */ 12 /* RATE_54 */ }; // see IEEE802.11a-1999 p.14
+static UINT _11G_RATES[12] = { 0, 0, 0, 0, 6, 9, 12, 18, 24, 36, 48, 54 };
#define COLLECT_RX_ANTENNA_AVERAGE_RSSI(_pAd, _RxAnt, _rssi) \
{ \
@@ -1132,9 +1133,61 @@
if (pAdapter->PortCfg.BssType == BSS_MONITOR)
{
struct sk_buff *skb;
+ wlan_ng_prism2_header *ph;
if ((skb = __dev_alloc_skb(2048, GFP_DMA|GFP_ATOMIC)) != NULL)
{
+ // setup the wlan-ng prismheader
+
+ if (skb_headroom(skb) < sizeof(wlan_ng_prism2_header))
+ pskb_expand_head(skb, sizeof(wlan_ng_prism2_header), 0, GFP_ATOMIC);
+
+ ph = (wlan_ng_prism2_header *)
+ skb_push(skb, sizeof(wlan_ng_prism2_header));
+ memset(ph, 0, sizeof(wlan_ng_prism2_header));
+
+ ph->msgcode = DIDmsg_lnxind_wlansniffrm;
+ ph->msglen = sizeof(wlan_ng_prism2_header);
+ strcpy(ph->devname, pAdapter->net_dev->name);
+
+ ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime;
+ ph->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime;
+ ph->channel.did = DIDmsg_lnxind_wlansniffrm_channel;
+ ph->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi;
+ ph->signal.did = DIDmsg_lnxind_wlansniffrm_signal;
+ ph->noise.did = DIDmsg_lnxind_wlansniffrm_noise;
+ ph->rate.did = DIDmsg_lnxind_wlansniffrm_rate;
+ ph->istx.did = DIDmsg_lnxind_wlansniffrm_istx;
+ ph->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen;
+
+ ph->hosttime.len = 4;
+ ph->mactime.len = 4;
+ ph->channel.len = 4;
+ ph->rssi.len = 4;
+ ph->signal.len = 4;
+ ph->noise.len = 4;
+ ph->rate.len = 4;
+ ph->istx.len = 4;
+ ph->frmlen.len = 4;
+
+ ph->hosttime.data = jiffies;
+ ph->signal.data = pRxD->BBR1;
+ ph->channel.data = pAdapter->PortCfg.IbssConfig.Channel;
+ ph->noise.data = pAdapter->PortCfg.LastR17Value;
+ ph->rssi.data = ph->signal.data - ph->noise.data;
+ ph->frmlen.data = pRxD->DataByteCnt;
+
+ if (pRxD->Ofdm == 1)
+ {
+ for (i = 4; i < 12; i++)
+ if (pRxD->BBR0 == PlcpSignal[i])
+ ph->rate.data = _11G_RATES[i] * 2;
+ }
+ else
+ ph->rate.data = pRxD->BBR0 / 5;
+
+ // end prismheader setup
+
skb->dev = pAdapter->net_dev;
memcpy(skb_put(skb, pRxD->DataByteCnt), pData, pRxD->DataByteCnt);
skb->mac.raw = skb->data;
diff -ur ../rt2500-cvs-20051008/Module/rtmp.h ./Module/rtmp.h
--- ../rt2500-cvs-20051008/Module/rtmp.h 2005-10-06 04:53:08.000000000 +0200
+++ ./Module/rtmp.h 2005-10-09 00:10:27.000000000 +0200
@@ -2549,4 +2549,54 @@
IN ULONG DescriptorType);
#endif
+#ifndef _PRISMHEADER
+#define _PRISMHEADER
+
+enum {
+ DIDmsg_lnxind_wlansniffrm = 0x00000044,
+ DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044,
+ DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044,
+ DIDmsg_lnxind_wlansniffrm_channel = 0x00030044,
+ DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044,
+ DIDmsg_lnxind_wlansniffrm_sq = 0x00050044,
+ DIDmsg_lnxind_wlansniffrm_signal = 0x00060044,
+ DIDmsg_lnxind_wlansniffrm_noise = 0x00070044,
+ DIDmsg_lnxind_wlansniffrm_rate = 0x00080044,
+ DIDmsg_lnxind_wlansniffrm_istx = 0x00090044,
+ DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044
+};
+enum {
+ P80211ENUM_msgitem_status_no_value = 0x00
+};
+enum {
+ P80211ENUM_truth_false = 0x00,
+ P80211ENUM_truth_true = 0x01
+};
+
+typedef struct {
+ u_int32_t did;
+ u_int16_t status;
+ u_int16_t len;
+ u_int32_t data;
+} p80211item_uint32_t;
+
+typedef struct {
+ u_int32_t msgcode;
+ u_int32_t msglen;
+#define WLAN_DEVNAMELEN_MAX 16
+ u_int8_t devname[WLAN_DEVNAMELEN_MAX];
+ p80211item_uint32_t hosttime;
+ p80211item_uint32_t mactime;
+ p80211item_uint32_t channel;
+ p80211item_uint32_t rssi;
+ p80211item_uint32_t sq;
+ p80211item_uint32_t signal;
+ p80211item_uint32_t noise;
+ p80211item_uint32_t rate;
+ p80211item_uint32_t istx;
+ p80211item_uint32_t frmlen;
+} wlan_ng_prism2_header;
+
+#endif
+
#endif // __RTMP_H__
diff -ur ../rt2500-cvs-20051008/Module/rtmp_info.c ./Module/rtmp_info.c
--- ../rt2500-cvs-20051008/Module/rtmp_info.c 2005-10-06 04:53:08.000000000 +0200
+++ ./Module/rtmp_info.c 2005-10-09 00:07:51.000000000 +0200
@@ -1973,7 +1973,7 @@
{
if (pAdapter->PortCfg.BssType == BSS_MONITOR)
{
- pAdapter->net_dev->type = 801;
+ pAdapter->net_dev->type = 802; // ARPHRD_IEEE80211_PRISM
RTMP_IO_WRITE32(pAdapter, RXCSR0, 0x4e);
}
else |
Patch | aircrack-ng/patches/old/rt2500-cvs-2005112305.patch | diff -ur ../rt2500-cvs-2005112305/Module/rtmp_data.c ./Module/rtmp_data.c
--- ../rt2500-cvs-2005112305/Module/rtmp_data.c 2005-11-09 04:33:20.000000000 +0100
+++ ./Module/rtmp_data.c 2005-11-23 14:39:33.000000000 +0100
@@ -1137,6 +1137,9 @@
if ((skb = __dev_alloc_skb(2048, GFP_DMA|GFP_ATOMIC)) != NULL)
{
+ if (pAdapter->PortCfg.MallowRFMONTx == TRUE)
+ goto rfmontx_80211_receive;
+
// setup the wlan-ng prismheader
if (skb_headroom(skb) < sizeof(wlan_ng_prism2_header))
@@ -1188,6 +1191,8 @@
// end prismheader setup
+ rfmontx_80211_receive:
+
skb->dev = pAdapter->net_dev;
memcpy(skb_put(skb, pRxD->DataByteCnt), pData, pRxD->DataByteCnt);
skb->mac.raw = skb->data;
diff -ur ../rt2500-cvs-2005112305/Module/rtmp_info.c ./Module/rtmp_info.c
--- ../rt2500-cvs-2005112305/Module/rtmp_info.c 2005-11-19 16:48:46.000000000 +0100
+++ ./Module/rtmp_info.c 2005-11-23 15:22:15.000000000 +0100
@@ -1973,7 +1973,11 @@
{
if (pAdapter->PortCfg.BssType == BSS_MONITOR)
{
- pAdapter->net_dev->type = 802; // ARPHRD_IEEE80211_PRISM
+ if (pAdapter->PortCfg.MallowRFMONTx == TRUE)
+ pAdapter->net_dev->type = 801; // ARPHRD_IEEE80211
+ else
+ pAdapter->net_dev->type = 802; // ARPHRD_IEEE80211_PRISM
+
RTMP_IO_WRITE32(pAdapter, RXCSR0, 0x46);
}
else if (pAdapter->bAcceptPromiscuous == TRUE)
@@ -3828,9 +3832,15 @@
value = *pvalue;
if (value == 1)
+ {
pAdapter->PortCfg.MallowRFMONTx = TRUE;
+ pAdapter->net_dev->type = 801; // ARPHRD_IEEE80211
+ }
else if (!value)
+ {
pAdapter->PortCfg.MallowRFMONTx = FALSE;
+ pAdapter->net_dev->type = 802; // ARPHRD_IEEE80211_PRISM
+ }
else return -EINVAL;
} |
Patch | aircrack-ng/patches/old/rt2570-cvs-20050824.patch | diff -ur ../rt2570-cvs-20050824/Module/mlme.c ./Module/mlme.c
--- ../rt2570-cvs-20050824/Module/mlme.c 2005-08-17 11:00:39.000000000 +0200
+++ ./Module/mlme.c 2005-08-24 11:53:01.000000000 +0200
@@ -1690,7 +1690,7 @@
}
else
{
- pAd->PortCfg.TxRate = min((INT)(pAd->PortCfg.MaxTxRate), RATE_11);
+ pAd->PortCfg.TxRate = min((INT)(pAd->PortCfg.MaxTxRate), RATE_5_5);
}
}
}
diff -ur ../rt2570-cvs-20050824/Module/rtusb_bulk.c ./Module/rtusb_bulk.c
--- ../rt2570-cvs-20050824/Module/rtusb_bulk.c 2005-07-19 10:20:46.000000000 +0200
+++ ./Module/rtusb_bulk.c 2005-08-24 15:40:14.000000000 +0200
@@ -107,7 +107,8 @@
NdisReleaseSpinLock(&pAdapter->BulkOutLock);
return;
}
- else if (pAdapter->MediaState == NdisMediaStateDisconnected)
+ else if (pAdapter->MediaState == NdisMediaStateDisconnected &&
+ pAdapter->PortCfg.BssType != BSS_MONITOR)
{
//
// Since there is no connection, so we need to empty the Tx Bulk out Ring.
diff -ur ../rt2570-cvs-20050824/Module/rtusb_data.c ./Module/rtusb_data.c
--- ../rt2570-cvs-20050824/Module/rtusb_data.c 2005-08-17 11:00:39.000000000 +0200
+++ ./Module/rtusb_data.c 2005-08-24 15:37:06.000000000 +0200
@@ -84,7 +84,8 @@
return 0;
}
// Drop packets if no associations
- else if (!INFRA_ON(pAdapter) && !ADHOC_ON(pAdapter))
+ else if (!INFRA_ON(pAdapter) && !ADHOC_ON(pAdapter) &&
+ pAdapter->PortCfg.BssType != BSS_MONITOR)
{
RTUSBFreeSkbBuffer(skb);
return 0;
@@ -141,6 +142,14 @@
Priority = 0;
AccessCategory = 0;
+ if (skb && pAdapter->PortCfg.BssType == BSS_MONITOR)
+ {
+ NdisAcquireSpinLock(&pAdapter->SendTxWaitQueueLock);
+ skb_queue_tail(&pAdapter->SendTxWaitQueue, skb);
+ NdisReleaseSpinLock(&pAdapter->SendTxWaitQueueLock);
+ return (NDIS_STATUS_SUCCESS);
+ }
+
if (skb)
{
Priority = skb->priority;
@@ -806,6 +815,36 @@
DBGPRINT(RT_DEBUG_ERROR, "Error, Null skb data buffer!!!\n");
return (NDIS_STATUS_FAILURE);
}
+
+ if (pAdapter->PortCfg.BssType == BSS_MONITOR)
+ {
+ pTxContext = &pAdapter->TxContext[pAdapter->NextTxIndex];
+ pTxContext->InUse = TRUE;
+ pTxContext->LastOne = TRUE;
+
+ pAdapter->NextTxIndex++;
+ if (pAdapter->NextTxIndex >= TX_RING_SIZE)
+ pAdapter->NextTxIndex = 0;
+
+ pTxD = &(pTxContext->TransferBuffer->TxDesc);
+ memset(pTxD, 0, sizeof(TXD_STRUC));
+ pDest = pTxContext->TransferBuffer->WirelessPacket;
+
+ memcpy( pDest, skb->data, skb->len );
+
+ RTUSBWriteTxDescriptor(pTxD, FALSE, 0, FALSE, FALSE, TRUE, IFS_BACKOFF, skb->len, FALSE, 0, CW_MIN_IN_BITS, CW_MAX_IN_BITS, skb->len + 4, pAdapter->PortCfg.TxRate, 4, pAdapter->PortCfg.TxPreambleInUsed);
+
+ TransferBufferLength = skb->len + sizeof(TXD_STRUC);
+ if ((TransferBufferLength % 2) == 1)
+ TransferBufferLength++;
+
+ pTxContext->BulkOutSize = TransferBufferLength;
+ atomic_inc(&pAdapter->TxCount);
+ RTUSB_SET_BULK_FLAG(pAdapter, fRTUSB_BULK_OUT_DATA_FRAG);
+ RTUSBFreeSkbBuffer(skb);
+ return (NDIS_STATUS_SUCCESS);
+ }
+
if (NdisBufferLength < 14)
{
DBGPRINT_RAW(RT_DEBUG_ERROR, "RTUSBHardEncrypt --> Ndis Packet buffer error !!!\n");
diff -ur ../rt2570-cvs-20050824/Module/rtusb_info.c ./Module/rtusb_info.c
--- ../rt2570-cvs-20050824/Module/rtusb_info.c 2005-08-17 11:00:39.000000000 +0200
+++ ./Module/rtusb_info.c 2005-08-24 12:11:05.000000000 +0200
@@ -200,6 +200,12 @@
pAdapter->PortCfg.IbssConfig.Channel = chan;
DBGPRINT(RT_DEBUG_ERROR, "<==SIOCSIWFREQ[cmd=0x%x] (Channel=%d)\n", SIOCSIWFREQ, pAdapter->PortCfg.IbssConfig.Channel);
+ if (pAdapter->PortCfg.BssType == BSS_MONITOR)
+ {
+ pAdapter->PortCfg.Channel = pAdapter->PortCfg.IbssConfig.Channel;
+ AsicSwitchChannel(pAdapter, pAdapter->PortCfg.Channel);
+ AsicLockChannel(pAdapter, pAdapter->PortCfg.Channel);
+ }
return 0;
}
@@ -288,10 +294,15 @@
__u32 *mode, char *extra)
{
PRT2570ADAPTER pAdapter = (PRT2570ADAPTER) dev->priv;
- if (ADHOC_ON(pAdapter))
- *mode = IW_MODE_ADHOC;
+ if (pAdapter->PortCfg.BssType == BSS_MONITOR)
+ *mode = IW_MODE_MONITOR;
else
- *mode = IW_MODE_INFRA;
+ {
+ if (ADHOC_ON(pAdapter))
+ *mode = IW_MODE_ADHOC;
+ else
+ *mode = IW_MODE_INFRA;
+ }
DBGPRINT(RT_DEBUG_TEMP,"--->rtusb_ioctl_giwmode\n");
return 0;
}
diff -ur ../rt2570-cvs-20050824/Module/sync.c ./Module/sync.c
--- ../rt2570-cvs-20050824/Module/sync.c 2005-07-27 17:54:29.000000000 +0200
+++ ./Module/sync.c 2005-08-24 14:31:58.000000000 +0200
@@ -203,6 +203,9 @@
UCHAR Ssid[MAX_LEN_OF_SSID], SsidLen, ScanType, BssType;
ULONG Now;
+ if (pAd->PortCfg.BssType == BSS_MONITOR)
+ return;
+
DBGPRINT(RT_DEBUG_INFO, "SYNC - MlmeScanReqAction\n");
#if 0
// Check the total scan tries for one single OID command |
Patch | aircrack-ng/patches/old/rt2570-cvs-20051008-prismheader.patch | Only in ./Module: out.cap
Only in ./Module: out.txt
diff -ur ../rt2570-cvs-20051025/Module/rt2570sw.h ./Module/rt2570sw.h
--- ../rt2570-cvs-20051025/Module/rt2570sw.h 2005-10-21 19:31:22.000000000 +0200
+++ ./Module/rt2570sw.h 2005-11-04 11:31:47.000000000 +0100
@@ -3699,4 +3699,55 @@
int USB_CallUSBD(PRT2570ADAPTER Adapter,
IN PURB Urb);
+
+#endif
+
+#ifndef _PRISMHEADER
+#define _PRISMHEADER
+
+enum {
+ DIDmsg_lnxind_wlansniffrm = 0x00000044,
+ DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044,
+ DIDmsg_lnxind_wlansniffrm_mactime = 0x00020044,
+ DIDmsg_lnxind_wlansniffrm_channel = 0x00030044,
+ DIDmsg_lnxind_wlansniffrm_rssi = 0x00040044,
+ DIDmsg_lnxind_wlansniffrm_sq = 0x00050044,
+ DIDmsg_lnxind_wlansniffrm_signal = 0x00060044,
+ DIDmsg_lnxind_wlansniffrm_noise = 0x00070044,
+ DIDmsg_lnxind_wlansniffrm_rate = 0x00080044,
+ DIDmsg_lnxind_wlansniffrm_istx = 0x00090044,
+ DIDmsg_lnxind_wlansniffrm_frmlen = 0x000A0044
+};
+enum {
+ P80211ENUM_msgitem_status_no_value = 0x00
+};
+enum {
+ P80211ENUM_truth_false = 0x00,
+ P80211ENUM_truth_true = 0x01
+};
+
+typedef struct {
+ u_int32_t did;
+ u_int16_t status;
+ u_int16_t len;
+ u_int32_t data;
+} p80211item_uint32_t;
+
+typedef struct {
+ u_int32_t msgcode;
+ u_int32_t msglen;
+#define WLAN_DEVNAMELEN_MAX 16
+ u_int8_t devname[WLAN_DEVNAMELEN_MAX];
+ p80211item_uint32_t hosttime;
+ p80211item_uint32_t mactime;
+ p80211item_uint32_t channel;
+ p80211item_uint32_t rssi;
+ p80211item_uint32_t sq;
+ p80211item_uint32_t signal;
+ p80211item_uint32_t noise;
+ p80211item_uint32_t rate;
+ p80211item_uint32_t istx;
+ p80211item_uint32_t frmlen;
+} wlan_ng_prism2_header;
+
#endif
diff -ur ../rt2570-cvs-20051025/Module/rtusb_data.c ./Module/rtusb_data.c
--- ../rt2570-cvs-20051025/Module/rtusb_data.c 2005-09-21 01:43:50.000000000 +0200
+++ ./Module/rtusb_data.c 2005-11-04 17:40:27.000000000 +0100
@@ -40,6 +40,7 @@
0, /* RATE_1 */ 1, /* RATE_2 */ 2, /* RATE_5_5 */ 3, /* RATE_11 */ // see BBP spec
11, /* RATE_6 */ 15, /* RATE_9 */ 10, /* RATE_12 */ 14, /* RATE_18 */ // see IEEE802.11a-1999 p.14
9, /* RATE_24 */ 13, /* RATE_36 */ 8, /* RATE_48 */ 12 /* RATE_54 */ }; // see IEEE802.11a-1999 p.14
+static UINT _11G_RATES[12] = { 0, 0, 0, 0, 6, 9, 12, 18, 24, 36, 48, 54 };
static UCHAR SNAP_802_1H[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
static UCHAR SNAP_BRIDGE_TUNNEL[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8};
static UCHAR EAPOL[] = {0x88, 0x8e};
@@ -1672,6 +1673,7 @@
NDIS_802_11_ENCRYPTION_STATUS Cipher;
struct sk_buff *skb;
PVOID pManage;
+ wlan_ng_prism2_header *ph;
pRxContext= (PRX_CONTEXT)pUrb->context;
pAdapter = pRxContext->pAdapter;
@@ -1709,6 +1711,57 @@
struct sk_buff *skb;
if ((skb = __dev_alloc_skb(2048, GFP_DMA|GFP_ATOMIC)) != NULL)
{
+ // setup the wlan-ng prismheader
+
+ if (skb_headroom(skb) < sizeof(wlan_ng_prism2_header))
+ pskb_expand_head(skb, sizeof(wlan_ng_prism2_header), 0, GFP_ATOMIC);
+
+ ph = (wlan_ng_prism2_header *)
+ skb_push(skb, sizeof(wlan_ng_prism2_header));
+ memset(ph, 0, sizeof(wlan_ng_prism2_header));
+
+ ph->msgcode = DIDmsg_lnxind_wlansniffrm;
+ ph->msglen = sizeof(wlan_ng_prism2_header);
+ strcpy(ph->devname, pAdapter->net->name);
+
+ ph->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime;
+ ph->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime;
+ ph->channel.did = DIDmsg_lnxind_wlansniffrm_channel;
+ ph->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi;
+ ph->signal.did = DIDmsg_lnxind_wlansniffrm_signal;
+ ph->noise.did = DIDmsg_lnxind_wlansniffrm_noise;
+ ph->rate.did = DIDmsg_lnxind_wlansniffrm_rate;
+ ph->istx.did = DIDmsg_lnxind_wlansniffrm_istx;
+ ph->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen;
+
+ ph->hosttime.len = 4;
+ ph->mactime.len = 4;
+ ph->channel.len = 4;
+ ph->rssi.len = 4;
+ ph->signal.len = 4;
+ ph->noise.len = 4;
+ ph->rate.len = 4;
+ ph->istx.len = 4;
+ ph->frmlen.len = 4;
+
+ ph->hosttime.data = jiffies;
+ ph->channel.data = pAdapter->PortCfg.IbssConfig.Channel;
+ ph->signal.data = pRxD->BBR1;
+ ph->noise.data = pAdapter->PortCfg.LastR17Value;
+ ph->rssi.data = ph->signal.data - ph->noise.data;
+ ph->frmlen.data = pRxD->DataByteCnt;
+
+ if (pRxD->Ofdm == 1)
+ {
+ for (i = 4; i < 12; i++)
+ if (pRxD->BBR0 == PlcpSignal[i])
+ ph->rate.data = _11G_RATES[i] * 2;
+ }
+ else
+ ph->rate.data = pRxD->BBR0 / 5;
+
+ // end prismheader setup
+
skb->dev = pAdapter->net;
memcpy(skb_put(skb, pRxD->DataByteCnt-4), pData, pRxD->DataByteCnt-4);
skb->mac.raw = skb->data;
diff -ur ../rt2570-cvs-20051025/Module/rtusb_info.c ./Module/rtusb_info.c
--- ../rt2570-cvs-20051025/Module/rtusb_info.c 2005-10-23 15:33:57.000000000 +0200
+++ ./Module/rtusb_info.c 2005-11-04 11:31:47.000000000 +0100
@@ -200,7 +200,9 @@
pAdapter->PortCfg.IbssConfig.Channel = chan;
DBGPRINT(RT_DEBUG_ERROR, "<==SIOCSIWFREQ[cmd=0x%x] (Channel=%d)\n", SIOCSIWFREQ, pAdapter->PortCfg.IbssConfig.Channel);
- if (pAdapter->PortCfg.BssType == BSS_MONITOR && pAdapter->PortCfg.MallowRFMONTx == TRUE)
+ // CD: setting the channel in Monitor mode is unrelated to RFMONTx
+
+ if (pAdapter->PortCfg.BssType == BSS_MONITOR)
{
pAdapter->PortCfg.Channel = pAdapter->PortCfg.IbssConfig.Channel;
AsicSwitchChannel(pAdapter, pAdapter->PortCfg.Channel);
@@ -275,7 +277,7 @@
pAdapter->PortCfg.BssType=BSS_MONITOR;
RTUSBEnqueueInternalCmd(pAdapter, RT_OID_LINK_DOWN);
pAdapter->bConfigChanged = TRUE;
- pAdapter->net->type = 801;
+ pAdapter->net->type = 802; // ARPHRD_IEEE80211_PRISM
RTUSBWriteMACRegister(pAdapter, TXRX_CSR2, 0x4e);
break;
default: |
Patch | aircrack-ng/patches/old/rt2570-cvs-2005112305.patch | diff -ur ../rt2570-cvs-2005112305/Module/rtusb_data.c ./Module/rtusb_data.c
--- ../rt2570-cvs-2005112305/Module/rtusb_data.c 2005-11-04 23:53:18.000000000 +0100
+++ ./Module/rtusb_data.c 2005-11-23 14:44:16.000000000 +0100
@@ -1711,6 +1711,9 @@
struct sk_buff *skb;
if ((skb = __dev_alloc_skb(2048, GFP_DMA|GFP_ATOMIC)) != NULL)
{
+ if (pAdapter->PortCfg.MallowRFMONTx == TRUE)
+ goto rfmontx_80211_receive;
+
// setup the wlan-ng prismheader
if (skb_headroom(skb) < sizeof(wlan_ng_prism2_header))
@@ -1762,6 +1765,8 @@
// end prismheader setup
+ rfmontx_80211_receive:
+
skb->dev = pAdapter->net;
memcpy(skb_put(skb, pRxD->DataByteCnt-4), pData, pRxD->DataByteCnt-4);
skb->mac.raw = skb->data;
diff -ur ../rt2570-cvs-2005112305/Module/rtusb_info.c ./Module/rtusb_info.c
--- ../rt2570-cvs-2005112305/Module/rtusb_info.c 2005-11-20 22:54:28.000000000 +0100
+++ ./Module/rtusb_info.c 2005-11-23 14:51:47.000000000 +0100
@@ -277,7 +277,10 @@
pAdapter->PortCfg.BssType=BSS_MONITOR;
RTUSBEnqueueInternalCmd(pAdapter, RT_OID_LINK_DOWN);
pAdapter->bConfigChanged = TRUE;
- pAdapter->net->type = 802; // ARPHRD_IEEE80211_PRISM
+ if (pAdapter->PortCfg.MallowRFMONTx == TRUE)
+ pAdapter->net->type = 801; // ARPHRD_IEEE80211
+ else
+ pAdapter->net->type = 802; // ARPHRD_IEEE80211_PRISM
RTUSBWriteMACRegister(pAdapter, TXRX_CSR2, 0x4e);
break;
default:
@@ -1132,9 +1135,11 @@
{
case 1:
pAdapter->PortCfg.MallowRFMONTx = TRUE;
+ pAdapter->net->type = 801; // ARPHRD_IEEE80211
break;
case 0:
pAdapter->PortCfg.MallowRFMONTx = FALSE;
+ pAdapter->net->type = 802; // ARPHRD_IEEE80211_PRISM
break;
default:
return -EOPNOTSUPP; |
Patch | aircrack-ng/patches/old/rt73_2.6.24.patch | diff -Naur rt73-k2wrlz-2.0.1/Module/rtmp_def.h rt73-k2wrlz-2.0.1-24/Module/rtmp_def.h
--- rt73-k2wrlz-2.0.1/Module/rtmp_def.h 2007-07-10 10:01:32.000000000 +0200
+++ rt73-k2wrlz-2.0.1-24/Module/rtmp_def.h 2008-02-13 23:12:13.000000000 +0100
@@ -1,26 +1,26 @@
-/***************************************************************************
- * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
- * *
- * Licensed under the GNU GPL *
- * Original code supplied under license from RaLink Inc, 2004. *
+/***************************************************************************
+ * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ * *
+ * Licensed under the GNU GPL *
+ * Original code supplied under license from RaLink Inc, 2004. *
***************************************************************************/
-/***************************************************************************
+/***************************************************************************
* Module Name: rtmp_def.h
*
* Abstract: Miniport related definition header
@@ -31,7 +31,7 @@
* Paul Lin 08-01-2002 created
* John Chang 08-05-2003 add definition for 11g & other drafts
* idamlaj 04-10-2006 Add extra devices
- *
+ *
***************************************************************************/
#ifndef __RTMP_DEF_H__
@@ -61,7 +61,7 @@
#define TYPE_RXD 1
#endif
-//WEP
+//WEP
#define WEP_SMALL_KEY_LEN (40/8)
#define WEP_LARGE_KEY_LEN (104/8)
@@ -237,7 +237,7 @@
#define MAX_LEN_OF_SUPPORTED_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54
#define MAX_LEN_OF_KEY 32 // 32 octets == 256 bits, Redefine for WPA
-#define MAX_NUM_OF_CHANNELS 43 //1-14, 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/
+#define MAX_NUM_OF_CHANNELS 43 //1-14, 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/
//128/132/136/140/149/153/157/161/165/34/38/42/46 + 1 as NULL termination
#define MAX_NUM_OF_A_CHANNELS 24 //36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165
#define J52_CHANNEL_START_OFFSET 38 //1-14, 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/
@@ -245,7 +245,7 @@
#define MAX_LEN_OF_SSID 32
#define CIPHER_TEXT_LEN 128
#define MAX_LEN_OF_MLME_BUFFER 2048
-#define MAX_MLME_HANDLER_MEMORY 20 //each them cantains MAX_LEN_OF_MLME_BUFFER size
+#define MAX_MLME_HANDLER_MEMORY 20 //each them cantains MAX_LEN_OF_MLME_BUFFER size
#define MAX_FRAME_LEN 2338
#define MAX_VIE_LEN 160 // New for WPA cipher suite variable IE sizes.
@@ -304,7 +304,7 @@
#define MLME_SUCCESS 0
#define MLME_UNSPECIFY_FAIL 1
#define MLME_CANNOT_SUPPORT_CAP 10
-#define MLME_REASSOC_DENY_ASSOC_EXIST 11
+#define MLME_REASSOC_DENY_ASSOC_EXIST 11
#define MLME_ASSOC_DENY_OUT_SCOPE 12
#define MLME_ALG_NOT_SUPPORT 13
#define MLME_SEQ_NR_OUT_OF_SEQUENCE 14
@@ -334,7 +334,7 @@
#define IE_802_11D_REQUEST 10 // 802.11d
#define IE_QBSS_LOAD 11 // 802.11e d9
#define IE_EDCA_PARAMETER 12 // 802.11e d9
-#define IE_TSPEC 13 // 802.11e d9
+#define IE_TSPEC 13 // 802.11e d9
#define IE_TCLAS 14 // 802.11e d9
#define IE_SCHEDULE 15 // 802.11e d9
#define IE_CHALLENGE_TEXT 16
@@ -422,7 +422,7 @@
#define ASSOC_MACHINE_BASE 0
#define MT2_MLME_ASSOC_REQ 0
#define MT2_MLME_REASSOC_REQ 1
-#define MT2_MLME_DISASSOC_REQ 2
+#define MT2_MLME_DISASSOC_REQ 2
#define MT2_PEER_DISASSOC_REQ 3
#define MT2_PEER_ASSOC_REQ 4
#define MT2_PEER_ASSOC_RSP 5
@@ -491,7 +491,7 @@
//
// STA's WPA-PSK State machine: states, events, total function #
-//
+//
#define WPA_PSK_IDLE 0
#define MAX_WPA_PSK_STATE 1
@@ -650,8 +650,8 @@
#define CIPHER_AES 4
#define CIPHER_CKIP64 5
#define CIPHER_CKIP128 6
-#define CIPHER_TKIP_NO_MIC 7 // MIC has been appended by driver, not a valid value in hardware key table
-
+#define CIPHER_TKIP_NO_MIC 7 // MIC has been appended by driver, not a valid value in hardware key table
+
// value domain for pAd->RfIcType
#define RFIC_5226 1 //A/B/G
@@ -813,6 +813,7 @@
// VID/PID
//-------------------
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
#define RT73_USB_DEVICES { \
{USB_DEVICE(0x0b05,0x1723)}, /* ASUS */ \
{USB_DEVICE(0x148f,0x2573)}, /* Ralink */ \
@@ -843,7 +844,38 @@
{USB_DEVICE(0x0df6,0x90ac)}, /* Sitecom */ \
{USB_DEVICE(0x13b1,0x0023)}, /* LinkSys */ \
{USB_DEVICE(0,0)}} /* end marker */
-
+#else
+#define RT73_USB_DEVICES { \
+ {USB_DEVICE(0x0b05,0x1723)}, /* ASUS */ \
+ {USB_DEVICE(0x148f,0x2573)}, /* Ralink */ \
+ {USB_DEVICE(0x148f,0x2671)}, /* Ralink */ \
+ {USB_DEVICE(0x18e8,0x6196)}, /* Qcom */ \
+ {USB_DEVICE(0x18e8,0x6229)}, /* Qcom */ \
+ {USB_DEVICE(0x1044,0x8008)}, /* Gigabyte */ \
+ {USB_DEVICE(0x14b2,0x3c22)}, /* Conceptronic */ \
+ {USB_DEVICE(0x0db0,0x6877)}, /* MSI */ \
+ {USB_DEVICE(0x0db0,0xa874)}, /* MSI */ \
+ {USB_DEVICE(0x0db0,0xa861)}, /* MSI */ \
+ {USB_DEVICE(0x07b8,0xb21d)}, /* AboCom */ \
+ {USB_DEVICE(0x0769,0x31f3)}, /* Surecom */ \
+ {USB_DEVICE(0x1472,0x0009)}, /* Huawei-3Com */ \
+ {USB_DEVICE(0x1371,0x9022)}, /* CNet */ \
+ {USB_DEVICE(0x1371,0x9032)}, /* CNet */ \
+ {USB_DEVICE(0x1631,0xc019)}, /* Billionton */ \
+ {USB_DEVICE(0x1044,0x800a)}, /* Gigabyte */ \
+ {USB_DEVICE(0x07d1,0x3c03)}, /* D-Link */ \
+ {USB_DEVICE(0x07d1,0x3c04)}, /* D-Link */ \
+ {USB_DEVICE(0x050d,0x7050)}, /* Belkin */ \
+ {USB_DEVICE(0x050d,0x705a)}, /* Belkin */ \
+ {USB_DEVICE(0x13b1,0x0020)}, /* Linksys */ \
+ {USB_DEVICE(0x18e8,0x6196)}, /* Qcom*/ \
+ {USB_DEVICE(0x0df6,0x9712)}, /* Sitecom */ \
+ {USB_DEVICE(0x06f8,0xe010)}, /* Hercules */ \
+ {USB_DEVICE(0x1690,0x0722)}, /* Askey */ \
+ {USB_DEVICE(0x0df6,0x90ac)}, /* Sitecom */ \
+ {USB_DEVICE(0x13b1,0x0023)}, /* LinkSys */ \
+ {}} /* end marker */
+#endif
#endif // __RTMP_DEF_H__
diff -Naur rt73-k2wrlz-2.0.1/Module/rtmp_main.c rt73-k2wrlz-2.0.1-24/Module/rtmp_main.c
--- rt73-k2wrlz-2.0.1/Module/rtmp_main.c 2007-10-26 21:35:39.000000000 +0200
+++ rt73-k2wrlz-2.0.1-24/Module/rtmp_main.c 2008-02-13 23:03:14.000000000 +0100
@@ -1,26 +1,26 @@
-/***************************************************************************
- * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
- * *
- * Licensed under the GNU GPL *
- * Original code supplied under license from RaLink Inc, 2004. *
+/***************************************************************************
+ * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ * *
+ * Licensed under the GNU GPL *
+ * Original code supplied under license from RaLink Inc, 2004. *
***************************************************************************/
-/***************************************************************************
+/***************************************************************************
* Module Name: rtmp_main.c
*
* Abstract: Main initialization routines
@@ -29,8 +29,8 @@
* Who When What
* -------- ---------- -----------------------------
* Jan Lee 01-10-2005 modified
- * idamlaj 04-10-2006 Apply patch by Ace17 (from forum)
- *
+ * idamlaj 04-10-2006 Apply patch by Ace17 (from forum)
+ *
***************************************************************************/
#include "rt_config.h"
@@ -67,7 +67,7 @@
/* module table */
struct usb_device_id rtusb_usb_id[] = RT73_USB_DEVICES;
-INT const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id);
+INT const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id);
MODULE_DEVICE_TABLE(usb, rtusb_usb_id);
@@ -158,7 +158,7 @@
// for cslip etc
pAd->stats.rx_compressed = 0;
pAd->stats.tx_compressed = 0;
-
+
return &pAd->stats;
}
@@ -214,22 +214,22 @@
#endif
VOID RTUSBHalt(
- IN PRTMP_ADAPTER pAd,
+ IN PRTMP_ADAPTER pAd,
IN BOOLEAN IsFree)
{
MLME_DISASSOC_REQ_STRUCT DisReq;
MLME_QUEUE_ELEM MsgElem;
INT i;
-
+
DBGPRINT(RT_DEBUG_TRACE, "====> RTUSBHalt\n");
//
- // before set flag fRTMP_ADAPTER_HALT_IN_PROGRESS,
+ // before set flag fRTMP_ADAPTER_HALT_IN_PROGRESS,
// we should send a disassoc frame to our AP.
//
if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))
{
- if (INFRA_ON(pAd))
+ if (INFRA_ON(pAd))
{
COPY_MAC_ADDR(DisReq.Addr, pAd->PortCfg.Bssid);
DisReq.Reason = REASON_DISASSOC_STA_LEAVING;
@@ -252,7 +252,7 @@
RTMPSendNullFrame(pAd, RATE_6);
RTMPusecDelay(1000);
}
-
+
// disable BEACON generation and other BEACON related hardware timers
AsicDisableSync(pAd);
RTMPSetLED(pAd, LED_HALT);
@@ -281,23 +281,23 @@
// Free the entire adapter object
ReleaseAdapter(pAd, IsFree, FALSE);
-
+
// reset mlme & command thread
pAd->MLMEThr_pid = -1;
pAd->RTUSBCmdThr_pid = -1;
-
+
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
}
VOID CMDHandler(
- IN PRTMP_ADAPTER pAd)
+ IN PRTMP_ADAPTER pAd)
{
PCmdQElmt cmdqelmt;
PUCHAR pData;
NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS;
ULONG IrqFlags;
ULONG Now;
-
+
while (pAd->CmdQ.size > 0)
{
NdisStatus = NDIS_STATUS_SUCCESS;
@@ -339,7 +339,7 @@
// Update extra information
pAd->ExtraInfo = HW_RADIO_OFF;
}
- }
+ }
}
break;
@@ -351,11 +351,11 @@
{
if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
{
- MlmeEnqueue(pAd,
+ MlmeEnqueue(pAd,
MLME_CNTL_STATE_MACHINE,
RT_CMD_RESET_MLME,
0,
- NULL);
+ NULL);
}
@@ -372,17 +372,17 @@
RTUSBMlmeUp(pAd);
}
break;
-
+
case RT_OID_802_11_BSSID:
{
if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
{
- MlmeEnqueue(pAd,
+ MlmeEnqueue(pAd,
MLME_CNTL_STATE_MACHINE,
RT_CMD_RESET_MLME,
0,
- NULL);
+ NULL);
}
@@ -399,16 +399,16 @@
RTUSBMlmeUp(pAd);
}
break;
-
+
case OID_802_11_SSID:
{
if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
- {
- MlmeEnqueue(pAd,
+ {
+ MlmeEnqueue(pAd,
MLME_CNTL_STATE_MACHINE,
RT_CMD_RESET_MLME,
0,
- NULL);
+ NULL);
}
@@ -421,7 +421,7 @@
MlmeEnqueue(pAd,
MLME_CNTL_STATE_MACHINE,
OID_802_11_SSID,
- cmdqelmt->bufferlength,
+ cmdqelmt->bufferlength,
pData);
RTUSBMlmeUp(pAd);
}
@@ -431,11 +431,11 @@
{
if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
{
- MlmeEnqueue(pAd,
+ MlmeEnqueue(pAd,
MLME_CNTL_STATE_MACHINE,
RT_CMD_RESET_MLME,
0,
- NULL);
+ NULL);
}
@@ -456,7 +456,7 @@
NDIS_802_11_ANTENNA Antenna = *(NDIS_802_11_ANTENNA *)pData;
- if (Antenna == 0)
+ if (Antenna == 0)
pAd->Antenna.field.RxDefaultAntenna = 1; // ant-A
else if(Antenna == 1)
pAd->Antenna.field.RxDefaultAntenna = 2; // ant-B
@@ -473,7 +473,7 @@
{
NDIS_802_11_ANTENNA Antenna = *(NDIS_802_11_ANTENNA *)pData;
- if (Antenna == 0)
+ if (Antenna == 0)
pAd->Antenna.field.TxDefaultAntenna = 1; // ant-A
else if(Antenna == 1)
pAd->Antenna.field.TxDefaultAntenna = 2; // ant-B
@@ -517,7 +517,7 @@
RTUSBReadEEPROM(pAd, Offset, pData + 4, Length);
}
break;
-
+
case RT_OID_USB_VENDOR_EEPROM_WRITE:
{
USHORT Offset = *((PUSHORT)pData);
@@ -563,26 +563,26 @@
case RT_OID_USB_RESET_BULK_OUT:
{
INT Index;
-
+
DBGPRINT_RAW(RT_DEBUG_ERROR, "RT_OID_USB_RESET_BULK_OUT\n");
-
+
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RESET_PIPE_IN_PROGRESS);
- RTUSBRejectPendingPackets(pAd); //reject all NDIS packets waiting in TX queue
+ RTUSBRejectPendingPackets(pAd); //reject all NDIS packets waiting in TX queue
RTUSBCancelPendingBulkOutIRP(pAd);
RTUSBCleanUpDataBulkOutQueue(pAd);
NICInitializeAsic(pAd);
ReleaseAdapter(pAd, FALSE, TRUE); // unlink urb releated tx context
NICInitTransmit(pAd);
-
- RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_PIPE_IN_PROGRESS);
-
+
+ RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_PIPE_IN_PROGRESS);
+
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
{
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
}
-
+
if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF))
{
for (Index = 0; Index < 4; Index++)
@@ -594,8 +594,8 @@
}
RTUSBKickBulkOut(pAd);
- }
- }
+ }
+ }
break;
@@ -618,7 +618,7 @@
}
if (pRxContext->TransferBuffer != NULL)
{
- kfree(pRxContext->TransferBuffer);
+ kfree(pRxContext->TransferBuffer);
pRxContext->TransferBuffer = NULL;
}
}
@@ -722,9 +722,9 @@
//disable Rx
RTUSBWriteMACRegister(pAd, TXRX_CSR2, 1);
//Ask our device to complete any pending bulk in IRP.
- while ((atomic_read(&pAd->PendingRx) > 0) ||
+ while ((atomic_read(&pAd->PendingRx) > 0) ||
(pAd->BulkOutPending[0] == TRUE) ||
- (pAd->BulkOutPending[1] == TRUE) ||
+ (pAd->BulkOutPending[1] == TRUE) ||
(pAd->BulkOutPending[2] == TRUE) ||
(pAd->BulkOutPending[3] == TRUE))
@@ -743,7 +743,7 @@
}
if ((pAd->BulkOutPending[0] == TRUE) ||
- (pAd->BulkOutPending[1] == TRUE) ||
+ (pAd->BulkOutPending[1] == TRUE) ||
(pAd->BulkOutPending[2] == TRUE) ||
(pAd->BulkOutPending[3] == TRUE))
{
@@ -758,7 +758,7 @@
RTMPusecDelay(500000);
}
- NICResetFromError(pAd);
+ NICResetFromError(pAd);
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR))
{
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR);
@@ -814,12 +814,12 @@
case RT_OID_VENDOR_WRITE_RF:
{
ULONG Value = *((PULONG)pData);
-
+
DBGPRINT_RAW(RT_DEBUG_INFO, "value = 0x%08x\n", Value);
RTUSBWriteRFRegister(pAd, Value);
}
break;
-
+
case RT_OID_802_11_RESET_COUNTERS:
{
UCHAR Value[22];
@@ -865,7 +865,7 @@
NULL,
0);
break;
-#endif
+#endif
case RT_OID_VENDOR_FLIP_IQ:
{
ULONG Value1, Value2;
@@ -926,7 +926,7 @@
else
NdisStatus = NDIS_STATUS_FAILURE;
DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_NETWORK_TYPE_IN_USE (=%d)\n",NetType);
-
+
}
break;
case RT_OID_802_11_PHY_MODE:
@@ -958,7 +958,7 @@
pAd->PortCfg.GroupCipher = WepStatus;
#if 1
- if ((WepStatus == Ndis802_11Encryption1Enabled) &&
+ if ((WepStatus == Ndis802_11Encryption1Enabled) &&
(pAd->SharedKey[pAd->PortCfg.DefaultKeyId].KeyLen != 0))
{
if (pAd->SharedKey[pAd->PortCfg.DefaultKeyId].KeyLen <= 5)
@@ -973,7 +973,7 @@
pAd->SharedKey[pAd->PortCfg.DefaultKeyId].CipherAlg = CIPHER_WEP128;
}
-#if 0
+#if 0
RTUSBReadMACRegister_old(pAd, TXRX_CSR0, &Value);
Value &= 0xfe00;
Value |= ((LENGTH_802_11 << 3) | (pAd->PortCfg.CipherAlg));
@@ -1013,7 +1013,7 @@
Value &= 0xfe00;
RTUSBWriteMACRegister_old(pAd, TXRX_CSR0, Value);
#endif
- }else
+ }else
{
DBGPRINT(RT_DEBUG_ERROR, " ERROR Cipher !!! \n");
}
@@ -1027,7 +1027,7 @@
PNDIS_802_11_WEP pWepKey;
DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_WEP \n");
-
+
pWepKey = (PNDIS_802_11_WEP)pData;
KeyIdx = pWepKey->KeyIndex & 0x0fffffff;
@@ -1037,7 +1037,7 @@
NdisStatus = NDIS_STATUS_FAILURE;
DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_ADD_WEP, INVALID_DATA!!\n");
}
- else
+ else
{
UCHAR CipherAlg;
pAd->SharedKey[KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength;
@@ -1048,18 +1048,18 @@
{
// Default key for tx (shared key)
pAd->PortCfg.DefaultKeyId = (UCHAR) KeyIdx;
- }
+ }
AsicAddSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx, CipherAlg, pWepKey->KeyMaterial, NULL, NULL);
DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_WEP (KeyIdx=%d, Len=%d-byte)\n", KeyIdx, pWepKey->KeyLength);
}
}
break;
-
+
case OID_802_11_REMOVE_WEP:
{
ULONG KeyIdx;
-
+
KeyIdx = *(NDIS_802_11_KEY_INDEX *) pData;
if (KeyIdx & 0x80000000)
{
@@ -1081,14 +1081,14 @@
AsicRemoveSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx);
DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_REMOVE_WEP (KeyIdx=%d)\n", KeyIdx);
}
- }
+ }
}
break;
case OID_802_11_ADD_KEY_WEP:
{
PNDIS_802_11_KEY pKey;
- ULONG i, KeyIdx;
+ ULONG i, KeyIdx;
pKey = (PNDIS_802_11_KEY) pData;
KeyIdx = pKey->KeyIndex & 0x0fffffff;
@@ -1099,10 +1099,10 @@
NdisStatus = NDIS_STATUS_FAILURE;
DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_ADD_KEY_WEP, Invalid KeyIdx[=%d]!!\n", KeyIdx);
}
- else
+ else
{
UCHAR CipherAlg;
-
+
pAd->SharedKey[KeyIdx].KeyLen = (UCHAR) pKey->KeyLength;
memcpy(pAd->SharedKey[KeyIdx].Key, &pKey->KeyMaterial, pKey->KeyLength);
@@ -1118,12 +1118,12 @@
{
for(i = 1; i < (16 / pKey->KeyLength); i++)
{
- memcpy(&pAd->SharedKey[KeyIdx].Key[i * pKey->KeyLength],
- &pKey->KeyMaterial[0],
+ memcpy(&pAd->SharedKey[KeyIdx].Key[i * pKey->KeyLength],
+ &pKey->KeyMaterial[0],
pKey->KeyLength);
}
- memcpy(&pAd->SharedKey[KeyIdx].Key[i * pKey->KeyLength],
- &pKey->KeyMaterial[0],
+ memcpy(&pAd->SharedKey[KeyIdx].Key[i * pKey->KeyLength],
+ &pKey->KeyMaterial[0],
16 - (i * pKey->KeyLength));
}
@@ -1135,16 +1135,16 @@
}
AsicAddSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx, CipherAlg, pAd->SharedKey[KeyIdx].Key, NULL, NULL);
- DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_KEY_WEP (KeyIdx=%d, KeyLen=%d, CipherAlg=%d)\n",
+ DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_KEY_WEP (KeyIdx=%d, KeyLen=%d, CipherAlg=%d)\n",
pAd->PortCfg.DefaultKeyId, pAd->SharedKey[KeyIdx].KeyLen, pAd->SharedKey[KeyIdx].CipherAlg);
}
}
break;
case OID_802_11_ADD_KEY:
- {
+ {
PNDIS_802_11_KEY pkey = (PNDIS_802_11_KEY)pData;
-
+
NdisStatus = RTMPWPAAddKeyProc(pAd, pkey);
RTUSBBulkReceive(pAd);
DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_KEY\n");
@@ -1157,7 +1157,7 @@
{
ULONG KeyIdx;
-
+
KeyIdx = *(NDIS_802_11_KEY_INDEX *) pData;
if (KeyIdx & 0x80000000)
{
@@ -1179,7 +1179,7 @@
}
}
break;
-#if 0
+#if 0
{
//PNDIS_802_11_REMOVE_KEY pRemoveKey;
ULONG KeyIdx;
@@ -1190,7 +1190,7 @@
DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_REMOVE_WEP\n");
//if (InformationBufferLength != sizeof(NDIS_802_11_KEY_INDEX))
// Status = NDIS_STATUS_INVALID_LENGTH;
- //else
+ //else
{
KeyIdx = *(NDIS_802_11_KEY_INDEX *) pData;
@@ -1223,17 +1223,17 @@
{
PNDIS_802_11_REMOVE_KEY pRemoveKey;
ULONG KeyIdx;
-
+
pRemoveKey = (PNDIS_802_11_REMOVE_KEY) pData;
if (pAd->PortCfg.AuthMode >= Ndis802_11AuthModeWPA)
{
NdisStatus = RTMPWPARemoveKeyProc(pAd, pData);
DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::RTMPWPARemoveKeyProc\n");
}
- else
+ else
{
KeyIdx = pRemoveKey->KeyIndex;
-
+
if (KeyIdx & 0x80000000)
{
// Should never set default bit when remove key
@@ -1246,7 +1246,7 @@
if (KeyIdx >= 4)
{
NdisStatus = NDIS_STATUS_FAILURE;
- DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_REMOVE_KEY, Invalid KeyIdx[=%d]!!\n", KeyIdx);
+ DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_REMOVE_KEY, Invalid KeyIdx[=%d]!!\n", KeyIdx);
}
else
{
@@ -1260,24 +1260,24 @@
}
break;
-
+
case OID_802_11_POWER_MODE:
{
NDIS_802_11_POWER_MODE PowerMode = *(PNDIS_802_11_POWER_MODE) pData;
DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_POWER_MODE (=%d)\n",PowerMode);
-
+
// save user's policy here, but not change PortCfg.Psm immediately
- if (PowerMode == Ndis802_11PowerModeCAM)
+ if (PowerMode == Ndis802_11PowerModeCAM)
{
// clear PSM bit immediately
MlmeSetPsmBit(pAd, PWR_ACTIVE);
-
- OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
+
+ OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
if (pAd->PortCfg.bWindowsACCAMEnable == FALSE)
pAd->PortCfg.WindowsPowerMode = PowerMode;
pAd->PortCfg.WindowsBatteryPowerMode = PowerMode;
- }
- else if (PowerMode == Ndis802_11PowerModeMAX_PSP)
+ }
+ else if (PowerMode == Ndis802_11PowerModeMAX_PSP)
{
// do NOT turn on PSM bit here, wait until MlmeCheckPsmChange()
// to exclude certain situations.
@@ -1285,10 +1285,10 @@
if (pAd->PortCfg.bWindowsACCAMEnable == FALSE)
pAd->PortCfg.WindowsPowerMode = PowerMode;
pAd->PortCfg.WindowsBatteryPowerMode = PowerMode;
- OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
+ OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
pAd->PortCfg.DefaultListenCount = 5;
- }
- else if (PowerMode == Ndis802_11PowerModeFast_PSP)
+ }
+ else if (PowerMode == Ndis802_11PowerModeFast_PSP)
{
// do NOT turn on PSM bit here, wait until MlmeCheckPsmChange()
// to exclude certain situations.
@@ -1298,8 +1298,8 @@
pAd->PortCfg.WindowsPowerMode = PowerMode;
pAd->PortCfg.WindowsBatteryPowerMode = PowerMode;
pAd->PortCfg.DefaultListenCount = 3;
- }
- }
+ }
+ }
break;
case RT_PERFORM_SOFT_DIVERSITY:
@@ -1318,7 +1318,7 @@
break;
}
-
+
if (cmdqelmt->CmdFromNdis == TRUE)
{
if ((cmdqelmt->command != OID_802_11_BSSID_LIST_SCAN) &&
@@ -1330,20 +1330,20 @@
if ((cmdqelmt->command != RT_OID_MULTI_READ_MAC) &&
(cmdqelmt->command != RT_OID_VENDOR_READ_BBP) &&
-#ifdef DBG
+#ifdef DBG
(cmdqelmt->command != RT_OID_802_11_QUERY_HARDWARE_REGISTER) &&
-#endif
+#endif
(cmdqelmt->command != RT_OID_USB_VENDOR_EEPROM_READ))
{
if (cmdqelmt->buffer != NULL)
kfree(cmdqelmt->buffer);
}
-
+
kfree((PCmdQElmt)cmdqelmt);
}
else
cmdqelmt->InUse = FALSE;
-
+
}
@@ -1443,16 +1443,16 @@
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) net_dev->priv;
NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
UCHAR TmpPhy;
-
+
printk("rt73 driver version - %s\n", DRIVER_VERSION);
init_MUTEX(&(pAd->usbdev_semaphore));
-
+
// init mediastate to disconnected
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
-
+
pAd->rx_bh.func = RTUSBRxPacket;
-
+
// Initialize pAd->PortCfg to manufacture default
PortCfgInit(pAd);
@@ -1481,19 +1481,19 @@
{
goto out;
}
-
+
// Wait for hardware stable
{
ULONG MacCsr0 = 0, Index = 0;
-
+
do
{
Status = RTUSBReadMACRegister(pAd, MAC_CSR0, &MacCsr0);
if (MacCsr0 != 0)
break;
-
+
RTMPusecDelay(1000);
} while (Index++ < 1000);
DBGPRINT(RT_DEBUG_TRACE, "Init: MAC_CSR0=0x%08x, Status=0x%08x\n", MacCsr0, Status);
@@ -1509,8 +1509,8 @@
// Initialize Asics
NICInitializeAsic(pAd);
- // Read RaConfig profile parameters
-#ifdef READ_PROFILE_FROM_FILE
+ // Read RaConfig profile parameters
+#ifdef READ_PROFILE_FROM_FILE
RTMPReadParametersFromFile(pAd);
#endif
@@ -1560,7 +1560,7 @@
memcpy(pAd->net_dev->dev_addr, pAd->CurrentAddress, pAd->net_dev->addr_len);
else
memcpy(pAd->CurrentAddress, pAd->net_dev->dev_addr, pAd->net_dev->addr_len);
-
+
// Clear Reset Flag before starting receiving/transmitting
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS);
@@ -1577,10 +1577,10 @@
// USB_ID info for UI
pAd->VendorDesc = 0x148F2573;
-
+
// Start net_dev interface tx /rx
netif_start_queue(net_dev);
-
+
netif_carrier_on(net_dev);
netif_wake_queue(net_dev);
return 0;
@@ -1598,17 +1598,17 @@
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) net_dev->priv;
int ret;
int i = 0;
-
- DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup);
+
+ DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup);
DECLARE_WAITQUEUE (wait, current);
-
+
DBGPRINT(RT_DEBUG_TRACE,"-->rt73_close\n");
-
+
netif_carrier_off(pAd->net_dev);
netif_stop_queue(pAd->net_dev);
DBGPRINT(RT_DEBUG_INFO,"Ensure there are no more active urbs \n");
- // ensure there are no more active urbs.
+ // ensure there are no more active urbs.
add_wait_queue (&unlink_wakeup, &wait);
pAd->wait = &unlink_wakeup;
// maybe wait for deletions to finish.
@@ -1618,35 +1618,35 @@
DBGPRINT (RT_DEBUG_INFO,"waited for %d urb to complete\n", atomic_read(&pAd->PendingRx));
}
pAd->wait = NULL;
- remove_wait_queue (&unlink_wakeup, &wait);
+ remove_wait_queue (&unlink_wakeup, &wait);
- if (pAd->MLMEThr_pid >= 0)
+ if (pAd->MLMEThr_pid >= 0)
{
mlme_kill = 1;
RTUSBMlmeUp(pAd);
wmb(); // need to check
ret = kill_proc (pAd->MLMEThr_pid, SIGTERM, 1);
- if (ret)
+ if (ret)
{
printk (KERN_ERR "%s: unable to signal thread\n", pAd->net_dev->name);
//return ret; Fix process killing
}
wait_for_completion (&pAd->notify);
}
- if (pAd->RTUSBCmdThr_pid>= 0)
+ if (pAd->RTUSBCmdThr_pid>= 0)
{
RTUSBCmd_kill = 1;
RTUSBCMDUp(pAd);
wmb(); // need to check
ret = kill_proc (pAd->RTUSBCmdThr_pid, SIGTERM, 1);
- if (ret)
+ if (ret)
{
printk (KERN_ERR "%s: unable to signal thread\n", pAd->net_dev->name);
//return ret; Fix process killing
}
wait_for_completion (&pAd->notify);
}
-
+
RTUSBHalt(pAd, TRUE);
DBGPRINT(RT_DEBUG_TRACE,"<--rt73_close\n");
@@ -1676,7 +1676,7 @@
/* lock the device pointers , need to check if required*/
down(&(pAd->usbdev_semaphore));
- MlmeHandler(pAd);
+ MlmeHandler(pAd);
/* unlock the device pointers */
up(&(pAd->usbdev_semaphore));
@@ -1703,7 +1703,7 @@
}
#endif
- /* notify the exit routine that we're actually exiting now
+ /* notify the exit routine that we're actually exiting now
*
* complete()/wait_for_completion() is similar to up()/down(),
* except that complete() is safe in the case where the structure
@@ -1744,13 +1744,13 @@
/* lock the device pointers , need to check if required*/
down(&(pAd->usbdev_semaphore));
- CMDHandler(pAd);
+ CMDHandler(pAd);
/* unlock the device pointers */
up(&(pAd->usbdev_semaphore));
}
- /* notify the exit routine that we're actually exiting now
+ /* notify the exit routine that we're actually exiting now
*
* complete()/wait_for_completion() is similar to up()/down(),
* except that complete() is safe in the case where the structure
@@ -1771,12 +1771,12 @@
static void *usb_rtusb_probe(struct usb_device *dev, UINT interface,
const struct usb_device_id *id_table)
-{
+{
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL;
int i;
struct net_device *netdev;
int res = -ENOMEM;
-
+
for (i = 0; i < rtusb_usb_id_len; i++)
{
if (le32_to_cpu(dev->descriptor.idVendor) == rtusb_usb_id[i].idVendor &&
@@ -1797,20 +1797,22 @@
if(!netdev)
{
printk("alloc_etherdev failed\n");
-
+
MOD_DEC_USE_COUNT;
usb_dec_dev_use(dev);
return NULL;
}
-
+
pAd = netdev->priv;
pAd->net_dev = netdev;
netif_stop_queue(netdev);
pAd->config = dev->config;
pAd->pUsb_Dev= dev;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(pAd->net_dev);
+#endif
ether_setup(pAd->net_dev);
-
+
netdev->open = usb_rtusb_open;
netdev->hard_start_xmit = RTMPSendPackets;
netdev->stop = usb_rtusb_close;
@@ -1826,22 +1828,24 @@
pAd->net_dev->hard_header_len = 14;
pAd->net_dev->mtu = 1500;
pAd->net_dev->addr_len = 6;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
pAd->net_dev->weight = 64;
+#endif
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
- {// find available
+ {// find available
int i=0;
char slot_name[IFNAMSIZ];
struct net_device *device;
- struct usb_interface *ifp= &dev->actconfig->interface[interface]; // get interface from system
+ struct usb_interface *ifp= &dev->actconfig->interface[interface]; // get interface from system
struct usb_interface_descriptor *as;
- struct usb_endpoint_descriptor *ep;
+ struct usb_endpoint_descriptor *ep;
for (i = 0; i < 8; i++)
{
sprintf(slot_name, "rausb%d", i);
-
+
read_lock_bh(&dev_base_lock); // avoid multiple init
for (device = dev_base; device != NULL; device = device->next)
{
@@ -1876,13 +1880,13 @@
//pAd->rx_bh.data = (unsigned long)pAd;
pAd->rx_bh.func = RTUSBRxPacket;
-
+
res = register_netdev(pAd->net_dev);
if (res)
goto out;
return pAd;
-
+
out:
printk("register_netdev failed err=%d\n",res);
return NULL;
@@ -1892,16 +1896,16 @@
static void usb_rtusb_disconnect(struct usb_device *dev, void *ptr)
{
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) ptr;
-
+
if (!pAd)
return;
-
+
tasklet_kill(&pAd->rx_bh);
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST);
// for debug, wait to show some messages to /proc system
udelay(1);
- //After Add Thread implementation, Upon exec there, pAd->net_dev seems becomes NULL,
+ //After Add Thread implementation, Upon exec there, pAd->net_dev seems becomes NULL,
//need to check why???
//assert(pAd->net_dev != NULL)
if(pAd->net_dev != NULL)
@@ -1926,19 +1930,19 @@
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) net_dev->priv;
int ret;
int i = 0;
-
- DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup);
+
+ DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup);
DECLARE_WAITQUEUE (wait, current);
-
+
DBGPRINT(RT_DEBUG_TRACE,"-->rt73_close \n");
-
+
netif_carrier_off(pAd->net_dev);
netif_stop_queue(pAd->net_dev);
- // ensure there are no more active urbs.
+ // ensure there are no more active urbs.
add_wait_queue (&unlink_wakeup, &wait);
pAd->wait = &unlink_wakeup;
-
+
// maybe wait for deletions to finish.
while ((i < 25) && atomic_read(&pAd->PendingRx) > 0) {
#if LINUX_VERSION_CODE >KERNEL_VERSION(2,6,9)
@@ -1948,28 +1952,28 @@
i++;
}
pAd->wait = NULL;
- remove_wait_queue (&unlink_wakeup, &wait);
+ remove_wait_queue (&unlink_wakeup, &wait);
- if (pAd->MLMEThr_pid >= 0)
+ if (pAd->MLMEThr_pid >= 0)
{
mlme_kill = 1;
RTUSBMlmeUp(pAd);
wmb(); // need to check
ret = kill_proc (pAd->MLMEThr_pid, SIGTERM, 1);
- if (ret)
+ if (ret)
{
printk (KERN_ERR "%s: unable to signal thread\n", pAd->net_dev->name);
//return ret;
}
wait_for_completion (&pAd->notify);
}
- if (pAd->RTUSBCmdThr_pid>= 0)
+ if (pAd->RTUSBCmdThr_pid>= 0)
{
RTUSBCmd_kill = 1;
RTUSBCMDUp(pAd);
wmb(); // need to check
ret = kill_proc (pAd->RTUSBCmdThr_pid, SIGTERM, 1);
- if (ret)
+ if (ret)
{
printk (KERN_ERR "%s: unable to signal thread\n", pAd->net_dev->name);
//return ret;
@@ -1977,7 +1981,7 @@
wait_for_completion (&pAd->notify);
}
RTUSBHalt(pAd, TRUE);
-
+
DBGPRINT(RT_DEBUG_TRACE,"<--rt73_close \n");
return 0;
@@ -2008,13 +2012,13 @@
/* lock the device pointers , need to check if required*/
down(&(pAd->usbdev_semaphore));
- MlmeHandler(pAd);
+ MlmeHandler(pAd);
/* unlock the device pointers */
up(&(pAd->usbdev_semaphore));
}
- /* notify the exit routine that we're actually exiting now
+ /* notify the exit routine that we're actually exiting now
*
* complete()/wait_for_completion() is similar to up()/down(),
* except that complete() is safe in the case where the structure
@@ -2057,13 +2061,13 @@
/* lock the device pointers , need to check if required*/
down(&(pAd->usbdev_semaphore));
- CMDHandler(pAd);
+ CMDHandler(pAd);
/* unlock the device pointers */
up(&(pAd->usbdev_semaphore));
}
- /* notify the exit routine that we're actually exiting now
+ /* notify the exit routine that we're actually exiting now
*
* complete()/wait_for_completion() is similar to up()/down(),
* except that complete() is safe in the case where the structure
@@ -2082,7 +2086,7 @@
static int usb_rtusb_probe (struct usb_interface *intf,
const struct usb_device_id *id)
-{
+{
struct usb_device *dev = interface_to_usbdev(intf);
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL;
int i;
@@ -2111,19 +2115,21 @@
if(!netdev)
{
printk("alloc_etherdev failed\n");
-
+
module_put(THIS_MODULE);
return res;
}
-
+
pAd = netdev->priv;
pAd->net_dev = netdev;
netif_stop_queue(netdev);
pAd->config = &dev->config->desc;
pAd->pUsb_Dev = dev;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(pAd->net_dev);
+#endif
ether_setup(pAd->net_dev);
-
+
netdev->open = usb_rtusb_open;
netdev->stop = usb_rtusb_close;
netdev->priv = pAd;
@@ -2141,7 +2147,9 @@
pAd->net_dev->hard_header_len = 14;
pAd->net_dev->mtu = 1500;
pAd->net_dev->addr_len = 6;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
pAd->net_dev->weight = 64;
+#endif
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
@@ -2149,23 +2157,23 @@
pAd->RTUSBCmdThr_pid= -1;
SET_NETDEV_DEV(pAd->net_dev, &intf->dev);
-
- {// find available
+
+ {// find available
int i=0;
char slot_name[IFNAMSIZ];
//struct net_device *device;
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
-
+
for (i = 0; i < 8; i++)
{
sprintf(slot_name, "rausb%d", i);
-#if 1
- if(dev_get_by_name(slot_name)==NULL)
+#if 1
+ if(dev_get_by_name(&init_net, slot_name)==NULL)
break;
-#else
+#else
read_lock_bh(&dev_base_lock); // avoid multiple init
for (device = dev_base; device != NULL; device = device->next)
{
@@ -2175,9 +2183,9 @@
}
}
read_unlock_bh(&dev_base_lock);
-
+
if(device == NULL) break;
-#endif
+#endif
}
if(i == 8)
{
@@ -2194,18 +2202,18 @@
/* check out the endpoint: it has to be Interrupt & IN */
endpoint = &iface_desc->endpoint[i].desc;
-
+
/* get Max Packet Size from endpoint */
pAd->BulkOutMaxPacketSize = (USHORT)endpoint->wMaxPacketSize;
DBGPRINT(RT_DEBUG_TRACE, "BulkOutMaxPacketSize %d\n", pAd->BulkOutMaxPacketSize);
}
-
+
//bottom half data is assign at each task_scheduler
//pAd->rx_bh.data = (unsigned long)pAd;
pAd->rx_bh.func = RTUSBRxPacket;
-
+
res = register_netdev(pAd->net_dev);
if (res)
goto out;
@@ -2217,7 +2225,7 @@
usb_set_intfdata(intf, pAd);
return 0;
-
+
out:
printk("register_netdev failed err=%d\n",res);
free_netdev(netdev);
@@ -2229,7 +2237,7 @@
{
struct usb_device *dev = interface_to_usbdev(intf);
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL;
-
+
pAd = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL);
@@ -2238,11 +2246,11 @@
dev->bus->bus_name, dev->devpath);
if (!pAd)
return;
-
+
tasklet_kill(&pAd->rx_bh);
// for debug, wait to show some messages to /proc system
udelay(1);
- //After Add Thread implementation, Upon exec there, pAd->net_dev seems becomes NULL,
+ //After Add Thread implementation, Upon exec there, pAd->net_dev seems becomes NULL,
//need to check why???
//assert(pAd->net_dev != NULL)
if(pAd->net_dev!= NULL)
@@ -2295,7 +2303,7 @@
udelay(1);
udelay(1);
usb_deregister(&rtusb_driver);
-
+
printk("<=== rtusb exit\n");
}
/**************************************/ |
Patch | aircrack-ng/patches/old/rtl8180-0.21.patch | Only in .: .r8180_core.o.d
diff -ur ../rtl8180-0.21/ieee80211_tx.c ./ieee80211_tx.c
--- ../rtl8180-0.21/ieee80211_tx.c 2005-04-12 21:02:17.000000000 +0000
+++ ./ieee80211_tx.c 2005-10-12 17:38:19.000000000 +0000
@@ -577,6 +577,14 @@
spin_lock_irqsave(&ieee->lock,flags);
+ if (ieee->iw_mode == IW_MODE_MONITOR) {
+ ieee->func->hard_data_xmit(ieee->dev,skb,0);
+ dev_kfree_skb_any(skb);
+ ieee->stats.tx_packets++;
+ ieee->dev->trans_start = jiffies;
+ goto exit;
+ }
+
if(ieee->queue_stop){
IEEE80211DMESG("EE: IEEE hard_start_xmit invoked when kernel queue should be stopped");
netif_stop_queue(ieee->dev);
diff -ur ../rtl8180-0.21/r8180_core.c ./r8180_core.c
--- ../rtl8180-0.21/r8180_core.c 2005-04-12 12:39:56.000000000 +0000
+++ ./r8180_core.c 2005-10-12 17:42:25.000000000 +0000
@@ -2204,11 +2204,12 @@
void rtl8180_hard_data_xmit(struct net_device *dev,struct sk_buff *skb,short morefrag)
{
struct r8180_priv *priv = (struct r8180_priv *)dev->priv;
- int mode;
+ int mode, priority = LOW_PRIORITY;
//unsigned long flags;
mode = priv->ieee80211->iw_mode;
-
+ if( mode == IW_MODE_MONITOR )
+ priority = HI_PRIORITY;
/*
* This function doesn't require lock because we make
@@ -2220,13 +2221,13 @@
//spin_lock_irqsave(&priv->tx_lock,flags);
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ if (!check_nic_enought_desc(dev, priority)){
DMESG("Error: no descriptor left by previous TX (avail %d) ",
- get_curr_tx_free_desc(dev, LOW_PRIORITY));
+ get_curr_tx_free_desc(dev, priority));
ieee80211_r8180_stop_queue(priv->ieee80211);
}
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,0);
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, priority, morefrag,0);
+ if (!check_nic_enought_desc(dev, priority))
ieee80211_r8180_stop_queue(priv->ieee80211);
//spin_unlock_irqrestore(&priv->tx_lock,flags);
@@ -3411,10 +3412,18 @@
if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
rtl8180_IBSS_create(dev);
-/* if (priv->ieee80211->iw_mode == IW_MODE_MONITOR){
+ if (priv->ieee80211->iw_mode == IW_MODE_MONITOR) {
+ priv->retry_rts = 0;
+ priv->retry_data = 0;
+ rtl8180_tx_enable(dev);
+
netif_carrier_on(dev);
+ if(netif_queue_stopped(dev))
+ netif_wake_queue(dev);
+ else
+ netif_start_queue(dev);
}
-*/
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA) {
// rtl8180_tx_enable(dev);
@@ -3608,8 +3617,7 @@
pio_flags = (unsigned long)pci_resource_flags (pdev, 0);
if (!(pio_flags & IORESOURCE_IO)) {
- DMESG("%s: region #0 not a PIO resource, aborting",
- pdev->slot_name);
+ DMESG("r8180: region #0 not a PIO resource, aborting");
goto fail;
}
@@ -3629,8 +3637,7 @@
pmem_flags = pci_resource_flags (pdev, 1);
if (!(pmem_flags & IORESOURCE_MEM)) {
- DMESG("%s: region #1 not a MMIO resource, aborting",
- pdev->slot_name);
+ DMESG("r8180: region #1 not a MMIO resource, aborting");
goto fail;
} |
Patch | aircrack-ng/patches/old/rtl8187-mac80211-injection-speed-2.6.28-wl.patch | diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 54c0689..c0ade02 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -238,7 +238,10 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
hdr->flags = cpu_to_le32(flags);
hdr->len = 0;
hdr->rts_duration = rts_dur;
- hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ else
+ hdr->retry = 0;
buf = hdr;
ep = 2;
@@ -256,7 +259,10 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
memset(hdr, 0, sizeof(*hdr));
hdr->flags = cpu_to_le32(flags);
hdr->rts_duration = rts_dur;
- hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+ else
+ hdr->retry = 0;
hdr->tx_duration =
ieee80211_generic_frame_duration(dev, priv->vif,
skb->len, txrate); |
Patch | aircrack-ng/patches/old/rtl8187_1010.0622.patch | --- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_prismhdr/beta-8187/ieee80211.h 2006-11-29 20:28:16.152853116 +0100
@@ -156,6 +156,23 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+#define IW_MODE_MONITOR_PRISM 15
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
+++ rtl8187_prismhdr/beta-8187/r8187_core.c 2006-12-16 16:44:12.244211046 +0100
@@ -1112,7 +1112,10 @@
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ {
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ morefrag = 1;
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -2346,7 +2349,8 @@
if( flen <= rx_urb->actual_length){
- stats.signal = (desc[1] & 0x7f00)>>8;
+// stats.signal = (desc[1] & 0x7f00)>>8;
+ stats.signal = (desc[1] & 0xff00)>>8;
stats.noise = desc[1] &0xff;
stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
@@ -2368,6 +2372,8 @@
// priv->rxskb = skb;
// priv->tempstats = &stats;
+
+ stats.signal -= stats.noise;
if(!ieee80211_rx(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
+++ rtl8187_prismhdr/beta-8187/r8187.h 2006-12-16 16:44:31.418296142 +0100
@@ -148,7 +148,7 @@
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
+ short prism_hdr;
// struct timer_list scan_timer;
/*short scanpending;
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_prismhdr/ieee80211/ieee80211.h 2006-11-29 20:45:25.190415628 +0100
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_prismhdr/ieee80211/ieee80211_rx.c 2006-12-14 11:40:23.461865287 +0100
@@ -49,12 +49,72 @@
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, rx_stats->mac_time);
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_prismhdr/ieee80211/ieee80211_tx.c 2006-12-16 11:57:57.695139366 +0100
@@ -458,7 +458,8 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_prismhdr/ieee80211/ieee80211_softmac_wx.c 2006-11-29 20:43:49.275996836 +0100
@@ -245,8 +245,7 @@
goto out;
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
} |
Patch | aircrack-ng/patches/old/rtl8187_1010.0622v2-old.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_txpower/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/ieee80211.h 2007-01-24 20:49:55.897494222 +0100
@@ -156,6 +156,23 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+#define IW_MODE_MONITOR_PRISM 15
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_txpower/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_hw.h 2007-01-24 20:49:55.942487382 +0100
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_txpower/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225.h 2007-01-24 20:49:55.980481606 +0100
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_txpower/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225z2.c 2007-01-24 20:49:52.313039142 +0100
@@ -418,7 +418,10 @@
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
cck_power_level += priv->cck_txpwr_base;
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_txpower/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_wx.c 2007-01-24 20:49:52.347033974 +0100
@@ -21,6 +21,7 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
@@ -108,6 +109,61 @@
return ret;
}
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv(dev);
+ down(&priv->wx_sem);
+ wrqu->power.value = priv->chtxpwr_ofdm[1] + MIN_TX_POWER;
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
+ up(&priv->wx_sem);
+
+ return 0;
+}
+
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i = 0;
+ struct r8180_priv *priv = ieee80211_priv(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > MAX_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < MIN_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<=14;i++)
+ {
+ priv->chtxpwr[i] = wrqu->power.value + 1 - MIN_TX_POWER;
+ priv->chtxpwr_ofdm[i] = wrqu->power.value - MIN_TX_POWER;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
+ return ret;
+}
+
static int r8180_wx_set_rawtx(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
@@ -623,8 +679,8 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_txpower/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8187_core.c 2007-01-24 20:49:52.381028806 +0100
@@ -158,7 +158,6 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
@@ -407,13 +406,14 @@
return len;
}
-
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
{
@@ -1112,7 +1112,10 @@
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ {
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ morefrag = 1;
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -2291,13 +2294,17 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = NULL;
+ struct iwreq *wrq = NULL;
+
+ int ret=-1;
+
+ priv = (struct r8180_priv *)ieee80211_priv(dev);
down(&priv->wx_sem);
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+ wrq = (struct iwreq *)rq;
+
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
@@ -2346,7 +2353,8 @@
if( flen <= rx_urb->actual_length){
- stats.signal = (desc[1] & 0x7f00)>>8;
+// stats.signal = (desc[1] & 0x7f00)>>8;
+ stats.signal = (desc[1] & 0xff00)>>8;
stats.noise = desc[1] &0xff;
stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
@@ -2368,6 +2376,8 @@
// priv->rxskb = skb;
// priv->tempstats = &stats;
+
+ stats.signal -= stats.noise;
if(!ieee80211_rx(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
@@ -2418,7 +2428,12 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
if (dev_alloc_name(dev, ifname) < 0){
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_txpower/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8187.h 2007-01-24 20:49:56.017475982 +0100
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,10 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -148,7 +151,7 @@
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
+ short prism_hdr;
// struct timer_list scan_timer;
/*short scanpending;
diff -Naur rtl8187_orig/beta-8187/r8187.mod.c rtl8187_txpower/beta-8187/r8187.mod.c
--- rtl8187_orig/beta-8187/r8187.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8187.mod.c 2007-01-24 20:49:52.415023638 +0100
@@ -0,0 +1,25 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=";
+
+MODULE_ALIAS("usb:v0BDAp8187d*dc*dsc*dp*ic*isc*ip*");
+MODULE_ALIAS("usb:v0846p6100d*dc*dsc*dp*ic*isc*ip*");
+MODULE_ALIAS("usb:v0846p6A00d*dc*dsc*dp*ic*isc*ip*");
+
+MODULE_INFO(srcversion, "873BF2D6E209C814550BA28");
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_txpower/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt.c 2007-01-24 20:50:08.016651830 +0100
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,10 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c 2007-01-24 20:50:08.017651678 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,6 +21,10 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c 2007-01-24 20:50:08.054646054 +0100
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211_crypt";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211_crypt-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt-rtl.mod.c 2007-01-24 20:50:08.057645598 +0100
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c 2007-01-24 20:50:08.104638454 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,6 +20,10 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip-rtl.mod.c 2007-01-24 20:50:08.135633742 +0100
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211_crypt";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c 2007-01-24 20:50:08.138633286 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,6 +17,10 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep-rtl.mod.c 2007-01-24 20:50:08.192625078 +0100
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211_crypt";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_txpower/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211.h 2007-01-24 20:50:15.464519582 +0100
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_txpower/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_module.c 2007-01-24 20:50:08.195624622 +0100
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,10 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
diff -Naur rtl8187_orig/ieee80211/ieee80211-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211-rtl.mod.c 2007-01-24 20:50:08.237618238 +0100
@@ -0,0 +1,16 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211_crypt";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_txpower/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_rx.c 2007-01-24 20:50:08.240617782 +0100
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,83 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
+
#include "ieee80211.h"
static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_txpower/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_softmac.c 2007-01-24 20:50:08.295609422 +0100
@@ -386,9 +386,8 @@
void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
{
- down(&ieee->scan_sem);
-
short watchdog = 0;
+ down(&ieee->scan_sem);
do{
ieee->current_network.channel =
@@ -1467,12 +1466,13 @@
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c 2007-01-24 20:50:08.297609118 +0100
@@ -134,14 +134,14 @@
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
@@ -245,8 +245,7 @@
goto out;
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_txpower/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_tx.c 2007-01-24 20:50:08.351600910 +0100
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,10 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
@@ -458,7 +461,8 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success; |
Patch | aircrack-ng/patches/old/rtl8187_1010.0622v2.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_txpower/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/ieee80211.h 2007-02-17 13:42:56.967245565 +0100
@@ -156,6 +156,23 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+#define IW_MODE_MONITOR_PRISM 15
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_txpower/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_hw.h 2007-02-17 13:42:57.047246772 +0100
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_txpower/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225.h 2007-02-17 13:42:57.127247979 +0100
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_txpower/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225z2.c 2007-02-17 13:42:53.757197143 +0100
@@ -418,7 +418,10 @@
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
cck_power_level += priv->cck_txpwr_base;
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_txpower/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_wx.c 2007-02-17 13:42:53.787197595 +0100
@@ -21,6 +21,7 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
@@ -108,6 +109,63 @@
return ret;
}
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv(dev);
+ down(&priv->wx_sem);
+ wrqu->power.value = priv->chtxpwr_ofdm[1] + MIN_TX_POWER;
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
+ up(&priv->wx_sem);
+
+ return 0;
+}
+
+#if 0
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i = 0;
+ struct r8180_priv *priv = ieee80211_priv(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > MAX_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < MIN_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<=14;i++)
+ {
+ priv->chtxpwr[i] = wrqu->power.value + 1 - MIN_TX_POWER;
+ priv->chtxpwr_ofdm[i] = wrqu->power.value - MIN_TX_POWER;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
+ return ret;
+}
+#endif
+
static int r8180_wx_set_rawtx(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
@@ -623,8 +681,8 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ NULL, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_txpower/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8187_core.c 2007-02-17 13:42:53.827198198 +0100
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -98,6 +99,10 @@
#endif
static int channels = 0x3fff;
+#define DEBUG_EPROM
+#define DEBUG_REGISTERS
+#define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -158,7 +163,6 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
@@ -407,13 +411,14 @@
return len;
}
-
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
{
@@ -561,7 +566,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -575,9 +593,9 @@
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -1112,7 +1130,10 @@
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ {
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ morefrag = 1;
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1557,10 +1578,10 @@
struct r8180_priv *priv = ieee80211_priv(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
+ u8 hw_version;
+ u8 config3;
//FIXME: these constants are placed in a bad pleace.
@@ -1580,6 +1601,13 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
@@ -1622,7 +1650,11 @@
priv->ieee80211->mode = IEEE_G;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
@@ -1716,6 +1748,12 @@
priv->enable_gpio0 = 0;
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
@@ -1807,6 +1845,12 @@
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
@@ -2291,13 +2335,17 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = NULL;
+ struct iwreq *wrq = NULL;
+
+ int ret=-1;
+
+ priv = (struct r8180_priv *)ieee80211_priv(dev);
down(&priv->wx_sem);
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+ wrq = (struct iwreq *)rq;
+
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
@@ -2346,7 +2394,8 @@
if( flen <= rx_urb->actual_length){
- stats.signal = (desc[1] & 0x7f00)>>8;
+// stats.signal = (desc[1] & 0x7f00)>>8;
+ stats.signal = (desc[1] & 0xff00)>>8;
stats.noise = desc[1] &0xff;
stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
@@ -2368,6 +2417,8 @@
// priv->rxskb = skb;
// priv->tempstats = &stats;
+
+ stats.signal -= stats.noise;
if(!ieee80211_rx(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
@@ -2418,7 +2469,12 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
if (dev_alloc_name(dev, ifname) < 0){
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_txpower/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8187.h 2007-02-17 13:42:57.197249035 +0100
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,10 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -148,7 +151,7 @@
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
+ short prism_hdr;
// struct timer_list scan_timer;
/*short scanpending;
diff -Naur rtl8187_orig/beta-8187/r8187.mod.c rtl8187_txpower/beta-8187/r8187.mod.c
--- rtl8187_orig/beta-8187/r8187.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8187.mod.c 2007-02-17 13:42:53.827198198 +0100
@@ -0,0 +1,25 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211-rtl";
+
+MODULE_ALIAS("usb:v0BDAp8187d*dc*dsc*dp*ic*isc*ip*");
+MODULE_ALIAS("usb:v0846p6100d*dc*dsc*dp*ic*isc*ip*");
+MODULE_ALIAS("usb:v0846p6A00d*dc*dsc*dp*ic*isc*ip*");
+
+MODULE_INFO(srcversion, "B76939EB1EA6331677B0BFF");
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_txpower/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt.c 2007-02-17 13:43:15.707528258 +0100
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,10 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c 2007-02-17 13:43:15.707528258 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,20 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ #include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp-rtl.mod.c 2007-02-17 13:43:15.737528711 +0100
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211_crypt";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211_crypt-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt-rtl.mod.c 2007-02-17 13:43:15.747528862 +0100
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c 2007-02-17 13:43:15.797529616 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,22 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -431,7 +439,11 @@
static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+ struct hash_desc desc;
+#endif
struct scatterlist sg[2];
+ int ret=0;
if (tkey->tfm_michael == NULL) {
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
@@ -445,12 +457,21 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
+#else
+ if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
+ return -1;
- return 0;
+ desc.tfm = tkey->tfm_michael;
+ desc.flags = 0;
+ ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
+
+ return ret;
}
static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip-rtl.mod.c 2007-02-17 13:43:15.827530068 +0100
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211_crypt";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c 2007-02-17 13:43:15.837530219 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,22 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep-rtl.mod.c 2007-02-17 13:43:15.877530823 +0100
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+ .init = init_module,
+#ifdef CONFIG_MODULE_UNLOAD
+ .exit = cleanup_module,
+#endif
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211_crypt";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_txpower/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211.h 2007-02-17 13:43:11.897470784 +0100
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_txpower/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_module.c 2007-02-17 13:43:15.907531275 +0100
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,10 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
diff -Naur rtl8187_orig/ieee80211/ieee80211-rtl.mod.c rtl8187_txpower/ieee80211/ieee80211-rtl.mod.c
--- rtl8187_orig/ieee80211/ieee80211-rtl.mod.c 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211-rtl.mod.c 2007-02-17 13:43:15.937531728 +0100
@@ -0,0 +1,16 @@
+#include <linux/module.h>
+#include <linux/vermagic.h>
+#include <linux/compiler.h>
+
+MODULE_INFO(vermagic, VERMAGIC_STRING);
+
+struct module __this_module
+__attribute__((section(".gnu.linkonce.this_module"))) = {
+ .name = KBUILD_MODNAME,
+};
+
+static const char __module_depends[]
+__attribute_used__
+__attribute__((section(".modinfo"))) =
+"depends=ieee80211_crypt";
+
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_txpower/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_rx.c 2007-02-17 13:43:15.947531879 +0100
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,83 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
+
#include "ieee80211.h"
static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_txpower/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_softmac.c 2007-02-17 13:43:15.987532482 +0100
@@ -386,9 +386,8 @@
void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
{
- down(&ieee->scan_sem);
-
short watchdog = 0;
+ down(&ieee->scan_sem);
do{
ieee->current_network.channel =
@@ -1467,12 +1466,13 @@
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
@@ -2165,12 +2165,21 @@
ieee->wq = create_workqueue(DRV_NAME);
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq);
+#endif
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c 2007-02-17 13:43:16.057533538 +0100
@@ -134,14 +134,14 @@
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
@@ -245,8 +245,7 @@
goto out;
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_txpower/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_tx.c 2007-02-17 13:43:16.057533538 +0100
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,10 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
@@ -458,7 +461,8 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
diff -Naur rtl8187_orig/makedrv rtl8187_txpower/makedrv
--- rtl8187_orig/makedrv 2006-09-05 07:21:10.000000000 +0200
+++ rtl8187_txpower/makedrv 2007-02-17 13:42:37.616953671 +0100
@@ -5,6 +5,7 @@
cd ieee80211
make clean
make
+cp Module.symvers beta-8187/
cd ../beta-8187
make clean
make
diff -Naur rtl8187_orig/makedrvbk rtl8187_txpower/makedrvbk
--- rtl8187_orig/makedrvbk 2006-09-05 07:21:10.000000000 +0200
+++ rtl8187_txpower/makedrvbk 2007-02-17 13:42:41.357010089 +0100
@@ -1,9 +1,11 @@
#!/bin/bash
cd ieee80211/
+rm Module.symvers
make clean
make
cd -
+cp ieee80211/Module.symvers beta-8187/
cd beta-8187/
make clean
make |
Patch | aircrack-ng/patches/old/rtl8187_1025.patch | diff -Naur r8187_orig/ieee80211/ieee80211_crypt.c r8187_rawtx/ieee80211/ieee80211_crypt.c
--- r8187_orig/ieee80211/ieee80211_crypt.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_crypt.c 2007-05-13 09:55:23.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
diff -Naur r8187_orig/ieee80211/ieee80211_crypt_ccmp.c r8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- r8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-05-13 09:55:23.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
diff -Naur r8187_orig/ieee80211/ieee80211_crypt_tkip.c r8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- r8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-05-13 09:55:23.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,11 +20,21 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
MODULE_AUTHOR("Jouni Malinen");
@@ -431,7 +440,11 @@
static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+ struct hash_desc desc;
+#endif
struct scatterlist sg[2];
+ int ret = 0;
if (tkey->tfm_michael == NULL) {
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
@@ -445,12 +458,20 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
+#else
+ if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
+ return -1;
+ desc.tfm = tkey->tfm_michael;
+ desc.flags = 0;
+ ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
- return 0;
+ return ret;
}
static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
diff -Naur r8187_orig/ieee80211/ieee80211_crypt_wep.c r8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- r8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-05-13 09:55:23.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,11 +17,21 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
MODULE_AUTHOR("Jouni Malinen");
diff -Naur r8187_orig/ieee80211/ieee80211.h r8187_rawtx/ieee80211/ieee80211.h
--- r8187_orig/ieee80211/ieee80211.h 2007-12-05 09:27:45.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211.h 2007-05-13 09:55:27.000000000 +0200
@@ -108,6 +108,8 @@
#define ieee80211_start_protocol ieee80211_start_protocol_rtl
#define ieee80211_stop_protocol ieee80211_stop_protocol_rtl
#define ieee80211_rx_mgt ieee80211_rx_mgt_rtl
+#define ieee80211_stop_queue ieee80211_stop_queue_rtl
+#define ieee80211_wake_queue ieee80211_wake_queue_rtl
typedef struct ieee_param {
@@ -193,6 +195,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -1064,10 +1082,15 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct work_struct ps_request_tx_ack_wq;//for ps
struct work_struct hw_wakeup_wq;
@@ -1390,7 +1413,11 @@
extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
+#else
extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+#endif
extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
struct iw_request_info *info,
diff -Naur r8187_orig/ieee80211/ieee80211_module.c r8187_rawtx/ieee80211/ieee80211_module.c
--- r8187_orig/ieee80211/ieee80211_module.c 2007-12-03 10:07:33.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_module.c 2007-05-13 09:55:23.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
diff -Naur r8187_orig/ieee80211/ieee80211_rx.c r8187_rawtx/ieee80211/ieee80211_rx.c
--- r8187_orig/ieee80211/ieee80211_rx.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_rx.c 2007-05-13 09:55:23.000000000 +0200
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+//begin prism header code
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+ hdrlen = ieee80211_get_hdrlen(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
+//end prism header code
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
diff -Naur r8187_orig/ieee80211/ieee80211_softmac.c r8187_rawtx/ieee80211/ieee80211_softmac.c
--- r8187_orig/ieee80211/ieee80211_softmac.c 2007-12-05 09:26:56.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_softmac.c 2007-05-13 09:55:24.000000000 +0200
@@ -392,9 +392,16 @@
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
+{
+#endif
short watchdog = 0;
down(&ieee->scan_sem);
@@ -514,7 +521,11 @@
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
queue_work(ieee->wq, &ieee->softmac_scan_wq);
+#else
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
+#endif
}
}else
ieee->start_scan(ieee->dev);
@@ -994,8 +1005,14 @@
}
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
if(ieee80211_is_54g(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
@@ -1025,8 +1042,14 @@
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
@@ -1660,7 +1683,6 @@
unsigned long flags;
int i;
-
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1691,7 +1713,6 @@
}
/* called with 2nd parm 0, no tx mgmt lock required */
ieee80211_sta_wakeup(ieee,0);
-
for(i = 0; i < txb->nr_frags; i++) {
if (ieee->queue_stop){
@@ -1874,8 +1895,15 @@
netif_carrier_on(ieee->dev);
}
}
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
{
+#endif
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
@@ -2020,8 +2048,16 @@
notify_wx_assoc_event(ieee);
}
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
down(&ieee->wx_sem);
@@ -2225,13 +2261,22 @@
#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq);
+#endif
/// INIT_WORK(&ieee->ps_request_tx_ack_wq,(void(*)(void*))ieee->ps_request_tx_ack,ieee->dev);//for ps 07.26
diff -Naur r8187_orig/ieee80211/ieee80211_softmac_wx.c r8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- r8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-05-13 09:55:24.000000000 +0200
@@ -236,7 +236,7 @@
int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
@@ -246,7 +246,7 @@
if (wrqu->mode == IW_MODE_MONITOR){
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
@@ -259,13 +259,37 @@
ieee80211_start_protocol(ieee);
}
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
+ }
+
+
out:
up(&ieee->wx_sem);
return 0;
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
{
+#endif
short chan;
chan = ieee->current_network.channel;
@@ -356,7 +380,11 @@
spin_lock_irqsave(&ieee->lock, flags);
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
+#endif
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
diff -Naur r8187_orig/ieee80211/ieee80211_tx.c r8187_rawtx/ieee80211/ieee80211_tx.c
--- r8187_orig/ieee80211/ieee80211_tx.c 2007-12-05 09:53:21.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_tx.c 2007-05-13 09:55:24.000000000 +0200
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -481,19 +486,19 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
+
txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+ txb->nr_frags = 1;
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
diff -Naur r8187_orig/Makefile r8187_rawtx/Makefile
--- r8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ r8187_rawtx/Makefile 2007-05-13 09:54:38.000000000 +0200
@@ -0,0 +1,36 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C rtl8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./rtl8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C rtl8187 $(@)
+
+distclean: clean
+
diff -Naur r8187_orig/rtl8187/ieee80211.h r8187_rawtx/rtl8187/ieee80211.h
--- r8187_orig/rtl8187/ieee80211.h 2007-12-05 09:50:41.000000000 +0100
+++ r8187_rawtx/rtl8187/ieee80211.h 2007-05-13 09:55:56.000000000 +0200
@@ -108,6 +108,8 @@
#define ieee80211_start_protocol ieee80211_start_protocol_rtl
#define ieee80211_stop_protocol ieee80211_stop_protocol_rtl
#define ieee80211_rx_mgt ieee80211_rx_mgt_rtl
+#define ieee80211_stop_queue ieee80211_stop_queue_rtl
+#define ieee80211_wake_queue ieee80211_wake_queue_rtl
typedef struct ieee_param {
@@ -193,6 +195,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -1064,10 +1082,15 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct work_struct ps_request_tx_ack_wq;//for ps
struct work_struct hw_wakeup_wq;
@@ -1390,7 +1413,11 @@
extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
+#else
extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+#endif
extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
struct iw_request_info *info,
diff -Naur r8187_orig/rtl8187/r8180_rtl8225.h r8187_rawtx/rtl8187/r8180_rtl8225.h
--- r8187_orig/rtl8187/r8180_rtl8225.h 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/rtl8187/r8180_rtl8225.h 2007-05-13 09:55:56.000000000 +0200
@@ -48,4 +48,5 @@
extern u32 rtl8225_chan[];
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
#endif
diff -Naur r8187_orig/rtl8187/r8180_wx.c r8187_rawtx/rtl8187/r8180_wx.c
--- r8187_orig/rtl8187/r8180_wx.c 2007-03-02 04:22:29.000000000 +0100
+++ r8187_rawtx/rtl8187/r8180_wx.c 2007-05-13 09:55:52.000000000 +0200
@@ -21,7 +21,7 @@
#include "r8187.h"
#include "r8180_hw.h"
-
+#include "r8180_rtl8225.h"
//#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
@@ -121,22 +121,72 @@
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
}
+#endif
static int r8180_wx_set_rts(struct net_device *dev,
struct iw_request_info *info,
@@ -836,6 +886,7 @@
}
+#if 0
static int r8180_wx_radio_on(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
@@ -871,6 +922,7 @@
return 0;
}
+#endif
static int r8180_wx_set_channelplan(struct net_device *dev,
struct iw_request_info *info,
@@ -965,8 +1017,8 @@
r8180_wx_get_rts, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
@@ -1007,7 +1059,7 @@
},
{
SIOCIWFIRSTPRIV + 0x6,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ 0, 0, "dummy"
},
{ SIOCIWFIRSTPRIV + 0x7,
0, 0, "dummy"
@@ -1053,11 +1105,11 @@
},
{
SIOCIWFIRSTPRIV + 0x12,
- 0, 0, "radioon"
+ 0, 0, "dummy"
},
{
SIOCIWFIRSTPRIV + 0x13,
- 0, 0, "radiooff"
+ 0, 0, "dummy"
},
{
SIOCIWFIRSTPRIV + 0x14,
@@ -1089,7 +1141,7 @@
dummy,
r8180_wx_set_scan_type,
dummy,
- r8180_wx_set_rawtx,
+ dummy,
dummy,
r8180_wx_set_iwmode,
r8180_wx_get_iwmode,
@@ -1101,8 +1153,8 @@
r8180_wx_get_sigqual,
r8180_wx_reset_stats,
dummy,
- r8180_wx_radio_on,
- r8180_wx_radio_off,
+ dummy,
+ dummy,
r8180_wx_set_channelplan,
r8180_wx_get_channelplan,
dummy,
diff -Naur r8187_orig/rtl8187/r8187_core.c r8187_rawtx/rtl8187/r8187_core.c
--- r8187_orig/rtl8187/r8187_core.c 2007-03-28 08:39:13.000000000 +0200
+++ r8187_rawtx/rtl8187/r8187_core.c 2007-05-13 09:55:52.000000000 +0200
@@ -83,6 +83,10 @@
#define USB_VENDOR_ID_NETGEAR 0x0846
#endif
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
+
static struct usb_device_id rtl8187_usb_id_tbl[] = {
{USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)},
{USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)},
@@ -271,9 +275,14 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
-void rtl8180_restart(struct net_device *dev);
void rtl8180_rq_tx_ack(struct net_device *dev);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
+void rtl8180_restart(struct net_device *dev);
+#endif
+
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
*****************************************************************************/
@@ -436,13 +445,14 @@
return len;
}
-
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
{
@@ -727,7 +737,7 @@
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
- RX_URB_SIZE,rtl8187_rx_isr,dev);
+ RX_URB_SIZE,rtl8187_rx_isr, dev);
err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
@@ -880,9 +890,12 @@
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
txconf = txconf &~ TCR_MXDMA_MASK;
@@ -1228,8 +1241,9 @@
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ morefrag = 1;
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1240,21 +1254,28 @@
*/
spin_lock_irqsave(&priv->tx_lock,flags);
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ rtl8180_tx(dev, skb->data, skb->len, NORM_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
}
+ else
+ {
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue(priv->ieee80211);
+ }
+
+ rtl8180_tx(dev, skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
-
- rtl8180_tx(dev, skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
+ priv->stats.txdatapkt++;
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue(priv->ieee80211);
+ }
+
spin_unlock_irqrestore(&priv->tx_lock,flags);
}
@@ -2050,11 +2071,19 @@
priv->ieee80211->mode = IEEE_G|IEEE_B; //2007.1.25
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
INIT_WORK(&priv->rtl8180_hw_wakeup_wq,(void(*)(void*))rtl8180_hw_wakeup,dev);
INIT_WORK(&priv->ieee80211->ps_request_tx_ack_wq,(void(*)(void*))rtl8180_rq_tx_ack,dev);
INIT_WORK(&priv->ieee80211->hw_wakeup_wq,(void(*)(void*))rtl8180_hw_wakeup,dev);
INIT_WORK(&priv->ieee80211->hw_sleep_wq,(void(*)(void*))rtl8180_hw_sleep,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+ INIT_WORK(&priv->rtl8180_hw_wakeup_wq,rtl8180_hw_wakeup);
+ INIT_WORK(&priv->ieee80211->ps_request_tx_ack_wq,rtl8180_rq_tx_ack);
+ INIT_WORK(&priv->ieee80211->hw_wakeup_wq,rtl8180_hw_wakeup);
+ INIT_WORK(&priv->ieee80211->hw_sleep_wq,rtl8180_hw_sleep);
+#endif
// INIT_WORK(&priv->ps_request_tx_ack_wq,(void(*)(void*))rtl8180_rq_tx_ack,dev);
sema_init(&priv->wx_sem,1);
sema_init(&priv->power_sem,1);
@@ -2259,6 +2288,15 @@
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
switch (priv->rf_chip) {
@@ -2701,10 +2739,16 @@
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
-
+#endif
down(&priv->wx_sem);
rtl8180_commit(dev);
@@ -2885,6 +2929,11 @@
// printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
//calculate link quality end
skb = dev_alloc_skb(flen-4);
if(skb){
@@ -2953,7 +3002,12 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
if (dev_alloc_name(dev, ifname) < 0){
diff -Naur r8187_orig/rtl8187/r8187.h r8187_rawtx/rtl8187/r8187.h
--- r8187_orig/rtl8187/r8187.h 2007-12-05 04:22:20.000000000 +0100
+++ r8187_rawtx/rtl8187/r8187.h 2007-05-13 09:55:56.000000000 +0200
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include "r8187_led.h"
#include "r8180_hw.h"
@@ -165,14 +170,17 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
u8 channel_plan; // it's the channel plan index
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
+ short prism_hdr;
struct timer_list ps_timer;
short PS_timeout;//when ps set on ,if tx timeout ,this will be set 1
diff -Naur r8187_orig/rtl8187/r8187_led.c r8187_rawtx/rtl8187/r8187_led.c
--- r8187_orig/rtl8187/r8187_led.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/rtl8187/r8187_led.c 2007-05-13 09:55:52.000000000 +0200
@@ -103,22 +103,34 @@
&(priv->Gpio0Led),
LED_PIN_GPIO0,
Gpio0LedBlinkTimerCallback);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->Gpio0LedWorkItem,
(void(*)(void*))Gpio0LedWorkItemCallback, dev);
+#else
+ INIT_WORK(&priv->Gpio0LedWorkItem, Gpio0LedWorkItemCallback);
+#endif
InitLed8187(dev,
&(priv->SwLed0),
LED_PIN_LED0,
SwLed0BlinkTimerCallback);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->SwLed0WorkItem,
(void(*)(void*))SwLed0WorkItemCallback, dev);
+#else
+ INIT_WORK(&priv->SwLed0WorkItem, SwLed0WorkItemCallback);
+#endif
InitLed8187(dev,
&(priv->SwLed1),
LED_PIN_LED1,
SwLed1BlinkTimerCallback);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->SwLed1WorkItem,
(void(*)(void*))SwLed1WorkItemCallback, dev);
+#else
+ INIT_WORK(&priv->SwLed1WorkItem, SwLed1WorkItemCallback);
+#endif
}
void
diff -Naur r8187_orig/symvers r8187_rawtx/symvers
--- r8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ r8187_rawtx/symvers 2007-05-13 09:54:44.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd rtl8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
\ Kein Zeilenumbruch am Dateiende. |
Patch | aircrack-ng/patches/old/rtl8187_1025v2.patch | diff -Naur r8187_orig/ieee80211/ieee80211_crypt.c r8187_rawtx/ieee80211/ieee80211_crypt.c
--- r8187_orig/ieee80211/ieee80211_crypt.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_crypt.c 2007-05-16 22:00:07.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
diff -Naur r8187_orig/ieee80211/ieee80211_crypt_ccmp.c r8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- r8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-05-16 22:00:07.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
diff -Naur r8187_orig/ieee80211/ieee80211_crypt_tkip.c r8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- r8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-05-16 22:00:07.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,11 +20,21 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
MODULE_AUTHOR("Jouni Malinen");
@@ -431,7 +440,11 @@
static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+ struct hash_desc desc;
+#endif
struct scatterlist sg[2];
+ int ret = 0;
if (tkey->tfm_michael == NULL) {
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
@@ -445,12 +458,20 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
+#else
+ if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
+ return -1;
+ desc.tfm = tkey->tfm_michael;
+ desc.flags = 0;
+ ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
- return 0;
+ return ret;
}
static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
diff -Naur r8187_orig/ieee80211/ieee80211_crypt_wep.c r8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- r8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-05-16 22:00:07.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,11 +17,21 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
MODULE_AUTHOR("Jouni Malinen");
diff -Naur r8187_orig/ieee80211/ieee80211.h r8187_rawtx/ieee80211/ieee80211.h
--- r8187_orig/ieee80211/ieee80211.h 2007-12-05 09:27:45.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211.h 2007-05-16 22:00:11.000000000 +0200
@@ -108,6 +108,8 @@
#define ieee80211_start_protocol ieee80211_start_protocol_rtl
#define ieee80211_stop_protocol ieee80211_stop_protocol_rtl
#define ieee80211_rx_mgt ieee80211_rx_mgt_rtl
+#define ieee80211_stop_queue ieee80211_stop_queue_rtl
+#define ieee80211_wake_queue ieee80211_wake_queue_rtl
typedef struct ieee_param {
@@ -193,6 +195,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -1064,10 +1082,15 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct work_struct ps_request_tx_ack_wq;//for ps
struct work_struct hw_wakeup_wq;
@@ -1390,7 +1413,11 @@
extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
+#else
extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+#endif
extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
struct iw_request_info *info,
diff -Naur r8187_orig/ieee80211/ieee80211_module.c r8187_rawtx/ieee80211/ieee80211_module.c
--- r8187_orig/ieee80211/ieee80211_module.c 2007-12-03 10:07:33.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_module.c 2007-05-16 22:00:07.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
diff -Naur r8187_orig/ieee80211/ieee80211_rx.c r8187_rawtx/ieee80211/ieee80211_rx.c
--- r8187_orig/ieee80211/ieee80211_rx.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_rx.c 2007-05-16 22:00:07.000000000 +0200
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+//begin prism header code
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+ hdrlen = ieee80211_get_hdrlen(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
+//end prism header code
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
diff -Naur r8187_orig/ieee80211/ieee80211_softmac.c r8187_rawtx/ieee80211/ieee80211_softmac.c
--- r8187_orig/ieee80211/ieee80211_softmac.c 2007-12-05 09:26:56.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_softmac.c 2007-05-16 22:00:07.000000000 +0200
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -37,25 +37,25 @@
unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
+ */
void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,9 +85,9 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
@@ -96,11 +96,11 @@
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
*/ //david, 2007.1.23
@@ -110,22 +110,22 @@
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
}
-
+
//return 0;
}
struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
@@ -143,19 +143,19 @@
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
ieee80211_sta_wakeup(ieee,0);
-
+
if(single){
-
+
if(ieee->queue_stop){
-
+
enqueue_mgmt(ieee,skb);
-
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -163,28 +163,28 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
//added by david, 2007.1.23
dev_kfree_skb_any(skb);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
@@ -192,36 +192,36 @@
inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
@@ -231,35 +231,35 @@
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
+
rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
- if (ieee->ps == IEEE80211_PS_DISABLED)
+ if (ieee->ps == IEEE80211_PS_DISABLED)
req->header.frame_ctl = IEEE80211_STYPE_PROBE_REQ;//changed!!
- else
+ else
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ|IEEE80211_FCTL_PM);//tony ,for ps ctl bit
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
+
ieee80211_MFIE_Brate(ieee,&tag);
ieee80211_MFIE_Grate(ieee,&tag);
return skb;
@@ -269,18 +269,18 @@
void ieee80211_send_beacon(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
+
+ unsigned long flags;
+
skb = ieee80211_get_beacon_(ieee);
if (skb){
softmac_mgmt_xmit(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -299,7 +299,7 @@
void ieee80211_send_probe(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
skb = ieee80211_probe_req(ieee);
if (skb){
softmac_mgmt_xmit(skb, ieee);
@@ -316,29 +316,29 @@
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -351,24 +351,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
// printk(KERN_INFO "current probe channel is %d!\n",ch);
ieee80211_send_probe_requests(ieee);
-
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -379,43 +379,50 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
+{
+#endif
short watchdog = 0;
down(&ieee->scan_sem);
-
-
+
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee80211_send_probe_requests(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -428,7 +435,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -438,13 +445,13 @@
void ieee80211_beacons_start(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
ieee80211_send_beacon(ieee);
-
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
@@ -476,25 +483,25 @@
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start(ieee);
}
void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
@@ -510,62 +517,66 @@
/* called with ieee->lock held */
void ieee80211_start_scan(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
queue_work(ieee->wq, &ieee->softmac_scan_wq);
+#else
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
+#endif
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
ieee80211_softmac_scan_syncro(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
if (ieee->ps != IEEE80211_PS_DISABLED) auth->header.frame_ctl |= IEEE80211_FCTL_PM;//tony 060624
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
@@ -577,23 +588,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -601,72 +612,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -679,52 +690,52 @@
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
+
unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
+
ieee80211_MFIE_Brate(ieee, &tag);
ieee80211_MFIE_Grate(ieee, &tag);
-
+
return skb;
}
@@ -732,59 +743,59 @@
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
{
struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+
if (buf)
softmac_mgmt_xmit(buf, ieee);
}
@@ -793,7 +804,7 @@
void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
{
struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+
if (buf)
softmac_mgmt_xmit(buf, ieee);
}
@@ -801,10 +812,10 @@
void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
{
-
+
struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
+
+ if (buf)
softmac_mgmt_xmit(buf, ieee);
}
@@ -812,72 +823,72 @@
inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
unsigned int rsn_len = beacon->rsn_ie_len;
-
+
unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ rsn_len
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
if (ieee->ps != IEEE80211_PS_DISABLED) hdr->header.frame_ctl |= IEEE80211_FCTL_PM; //tony
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); //tony 20060606
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
+
+ tag = skb_put(skb, rate_len);
+
ieee80211_MFIE_Brate(ieee, &tag);
ieee80211_MFIE_Grate(ieee, &tag);
-
+
tag = skb_put(skb,wpa_len);
-
+
if(wpa_len) {
if(wpa_len > (22 + 2) )
{
beacon->wpa_ie[wpa_len - 2] = 0;
}
-
+
}
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
tag = skb_put(skb,rsn_len);
if(rsn_len) {
@@ -890,12 +901,12 @@
void ieee80211_associate_abort(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -903,17 +914,17 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
@@ -927,50 +938,50 @@
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
+
+ if (!skb)
ieee80211_associate_abort(ieee);
- else{
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
softmac_mgmt_xmit(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
+
skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
+ if (!skb)
ieee80211_associate_abort(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
+
ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
+
softmac_mgmt_xmit(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
@@ -978,28 +989,34 @@
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
+ if (!skb)
ieee80211_associate_abort(ieee);
else{
softmac_mgmt_xmit(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
@@ -1007,7 +1024,7 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
@@ -1017,52 +1034,58 @@
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee80211_stop_scan(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
ieee80211_associate_step1(ieee);
-
+
up(&ieee->wx_sem);
}
inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1073,23 +1096,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1098,18 +1121,18 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1119,7 +1142,7 @@
}
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
@@ -1127,26 +1150,26 @@
void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
ieee80211_softmac_new_net(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
@@ -1154,7 +1177,7 @@
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1162,34 +1185,34 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
int auth_rq_parse(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
@@ -1199,21 +1222,21 @@
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1222,41 +1245,41 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
int assoc_rq_parse(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
@@ -1266,7 +1289,7 @@
ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
@@ -1284,26 +1307,26 @@
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
+
if ((status = auth_rq_parse(skb, dest))!= -1){
ieee80211_resp_to_auth(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
if (assoc_rq_parse(skb,dest) != -1){
ieee80211_resp_to_assoc_rq(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1317,24 +1340,24 @@
void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
{
-
+
struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
if (buf)
softmac_ps_mgmt_xmit(buf, ieee);
// printk(KERN_INFO "ieee80211_sta_ps_send_null_frame!\n");
-}
+}
short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1343,7 +1366,7 @@
return 0;
printk(KERN_INFO "VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
printk(KERN_INFO "no UCAST\n");
@@ -1358,11 +1381,11 @@
return 0;
printk(KERN_INFO "cc\n");
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
@@ -1372,8 +1395,8 @@
ieee->ps_tl=*time_l;
// printk(KERN_INFO "ieee->ps_tl %lu!\n",ieee->ps_tl);
return 1;
-
-
+
+
}
inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
@@ -1381,72 +1404,72 @@
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
//// printk(KERN_INFO "enter ieee80211_sta_ps!\n");
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
+
// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
+
+ ieee80211_sta_wakeup(ieee, 1);
printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
+
sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
//printk(KERN_INFO "sleep %d,th %lu, tl %lu,sta_sleep %d\n",sleep,th,tl,ieee->sta_sleep);
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
//ieee->enter_sleep_state(ieee->dev,th,tl);
queue_work(ieee->wq,&ieee->hw_sleep_wq);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
// ieee->ps_request_tx_ack(ieee->dev);
// printk(KERN_INFO "ps request address %lu!\n",ieee->ps_request_tx_ack);
- // queue_work(ieee->wq,&ieee->ps_request_tx_ack_wq);
+ // queue_work(ieee->wq,&ieee->ps_request_tx_ack_wq);
ieee80211_sta_ps_send_null_frame(ieee,1);
ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
ieee->ps_th = th;
ieee->ps_tl = tl;
// udelay(100);
ieee80211_ps_tx_ack(ieee,1);//add without interrupt like 8185
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
ieee80211_sta_wakeup(ieee,1);
printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
@@ -1460,14 +1483,14 @@
ieee80211_sta_ps_send_null_frame(ieee, 0);
}
return;
-
+
}
- if(ieee->sta_sleep == 1)
+ if(ieee->sta_sleep == 1)
//ieee->sta_wake_up(ieee->dev);
queue_work(ieee->wq,&ieee->hw_wakeup_wq);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
//ieee->ps_request_tx_ack(ieee->dev);
//queue_work(ieee->wq,&ieee->ps_request_tx_ack_wq);
@@ -1480,7 +1503,7 @@
unsigned long flags,flags2;
// printk(KERN_INFO "ieee80211_ps_tx_ack,success %d,sta_sleep %d!\n",success,ieee->sta_sleep);
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1495,7 +1518,7 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
ieee80211_sta_ps_send_null_frame(ieee, 0);
@@ -1519,66 +1542,66 @@
header = (struct ieee80211_hdr_3addr *) skb->data;
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED)) {
//// printk(KERN_INFO "schedule ps task!\n");
tasklet_schedule(&ieee->ps_task);}
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
if (0 == (errcode=assoc_parse(skb, &aid))){
-
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
+
ieee80211_associate_complete(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
+
ieee80211_rx_assoc_rq(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
+
if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
+
ieee80211_associate_step2(ieee);
}else{
ieee80211_auth_challenge(ieee, challenge, chlen);
@@ -1588,47 +1611,47 @@
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
ieee80211_associate_abort(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
ieee80211_rx_auth_rq(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
+
ieee80211_rx_probe_rq(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
+
notify_wx_assoc_event(ieee);
-
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1646,21 +1669,20 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
+ */
+
void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1671,13 +1693,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1691,9 +1713,8 @@
}
/* called with 2nd parm 0, no tx mgmt lock required */
ieee80211_sta_wakeup(ieee,0);
-
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
//added by david. 2007.1.23
if(ieee->tx_pending.txb != NULL) {
@@ -1709,16 +1730,16 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
+ }
lost:
//ieee80211_txb_free(txb);
-
+
exit:
atomic_dec(&ieee->tx_pending_txb);
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
@@ -1726,13 +1747,13 @@
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1740,8 +1761,8 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
+
+
//ieee80211_txb_free(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
@@ -1751,7 +1772,7 @@
{
unsigned long flags;
struct sk_buff *ret;
-
+
spin_lock_irqsave(&ieee->lock,flags);
// added by david, 2007.1.23
while((ret = dequeue_mgmt(ieee)) != NULL) {
@@ -1773,17 +1794,17 @@
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1799,12 +1820,12 @@
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
ieee80211_resume_tx(ieee);
-
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
@@ -1821,17 +1842,17 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
@@ -1841,61 +1862,68 @@
void ieee80211_start_master_bss(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
notify_wx_assoc_event(ieee);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
{
-
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
ieee80211_softmac_check_all_nets(ieee);
-
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1915,25 +1943,25 @@
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
ieee80211_randomize_cell(ieee);
-
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1942,34 +1970,34 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
+
notify_wx_assoc_event(ieee);
-
+
ieee80211_start_send_beacons(ieee);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
@@ -1988,7 +2016,7 @@
* in associating / authenticating phase) start the background scanning.
*/
ieee80211_softmac_check_all_nets(ieee);
-
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1997,10 +2025,10 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->state == IEEE80211_NOLINK)
ieee80211_start_scan(ieee);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
@@ -2008,30 +2036,38 @@
void ieee80211_disassociate(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
ieee80211_reset_queue(ieee);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
notify_wx_assoc_event(ieee);
-
+
}
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -2041,18 +2077,18 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
ieee80211_softmac_check_all_nets(ieee);
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
ieee80211_start_scan(ieee);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
@@ -2062,39 +2098,39 @@
struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
+
skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
+
skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
@@ -2111,14 +2147,14 @@
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
+
ieee80211_stop_send_beacons(ieee);
-
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
+ cancel_delayed_work(&ieee->associate_retry_wq);
+
ieee80211_stop_scan(ieee);
ieee80211_disassociate(ieee);
@@ -2135,28 +2171,28 @@
void ieee80211_start_protocol(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
+
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
+
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2167,18 +2203,18 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
ieee80211_start_bss(ieee);
-
+
else if (ieee->iw_mode == IW_MODE_ADHOC)
ieee80211_start_ibss(ieee);
-
+
else if (ieee->iw_mode == IW_MODE_MASTER)
ieee80211_start_master_bss(ieee);
-
+
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode(ieee);
}
@@ -2186,11 +2222,11 @@
void ieee80211_softmac_init(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2203,7 +2239,7 @@
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
+
init_mgmt_queue(ieee);
#if 0
init_timer(&ieee->scan_timer);
@@ -2211,7 +2247,7 @@
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
ieee->associate_timer.function = ieee80211_associate_abort_cb;
@@ -2219,28 +2255,37 @@
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq);
+#endif
/// INIT_WORK(&ieee->ps_request_tx_ack_wq,(void(*)(void*))ieee->ps_request_tx_ack,ieee->dev);//for ps 07.26
-
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
(void(*)(unsigned long)) ieee80211_sta_ps,
(unsigned long)ieee);
@@ -2250,20 +2295,20 @@
void ieee80211_softmac_free(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
+
static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
@@ -2273,7 +2318,7 @@
return 0;
}
-
+
void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
@@ -2285,7 +2330,7 @@
static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2339,7 +2384,7 @@
static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2435,7 +2480,7 @@
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2600,7 +2645,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2644,7 +2689,7 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
diff -Naur r8187_orig/ieee80211/ieee80211_softmac_wx.c r8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- r8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-05-16 22:00:07.000000000 +0200
@@ -236,7 +236,7 @@
int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
@@ -246,7 +246,7 @@
if (wrqu->mode == IW_MODE_MONITOR){
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
@@ -259,13 +259,37 @@
ieee80211_start_protocol(ieee);
}
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
+ }
+
+
out:
up(&ieee->wx_sem);
return 0;
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
{
+#endif
short chan;
chan = ieee->current_network.channel;
@@ -356,7 +380,11 @@
spin_lock_irqsave(&ieee->lock, flags);
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
+#endif
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
diff -Naur r8187_orig/ieee80211/ieee80211_tx.c r8187_rawtx/ieee80211/ieee80211_tx.c
--- r8187_orig/ieee80211/ieee80211_tx.c 2007-12-05 09:53:21.000000000 +0100
+++ r8187_rawtx/ieee80211/ieee80211_tx.c 2007-05-16 22:00:07.000000000 +0200
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -481,19 +486,19 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
+
txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+ txb->nr_frags = 1;
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
diff -Naur r8187_orig/Makefile r8187_rawtx/Makefile
--- r8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ r8187_rawtx/Makefile 2007-05-13 09:54:38.000000000 +0200
@@ -0,0 +1,36 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C rtl8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./rtl8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C rtl8187 $(@)
+
+distclean: clean
+
diff -Naur r8187_orig/rtl8187/ieee80211.h r8187_rawtx/rtl8187/ieee80211.h
--- r8187_orig/rtl8187/ieee80211.h 2007-12-05 09:50:41.000000000 +0100
+++ r8187_rawtx/rtl8187/ieee80211.h 2007-05-16 21:51:38.000000000 +0200
@@ -108,6 +108,8 @@
#define ieee80211_start_protocol ieee80211_start_protocol_rtl
#define ieee80211_stop_protocol ieee80211_stop_protocol_rtl
#define ieee80211_rx_mgt ieee80211_rx_mgt_rtl
+#define ieee80211_stop_queue ieee80211_stop_queue_rtl
+#define ieee80211_wake_queue ieee80211_wake_queue_rtl
typedef struct ieee_param {
@@ -193,6 +195,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -1064,10 +1082,15 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct work_struct ps_request_tx_ack_wq;//for ps
struct work_struct hw_wakeup_wq;
@@ -1390,7 +1413,11 @@
extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
+#else
extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+#endif
extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
struct iw_request_info *info,
diff -Naur r8187_orig/rtl8187/r8180_hw.h r8187_rawtx/rtl8187/r8180_hw.h
--- r8187_orig/rtl8187/r8180_hw.h 2007-12-03 12:30:10.000000000 +0100
+++ r8187_rawtx/rtl8187/r8180_hw.h 2007-05-16 21:51:38.000000000 +0200
@@ -1,16 +1,16 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official Realtek driver.
- Parts of this driver are based on the rtl8180 driver skeleton
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
- Parts of this driver are based on the Intel Pro Wireless
+ Parts of this driver are based on the Intel Pro Wireless
2100 GPL driver.
-
- We want to tanks the Authors of those projects
+
+ We want to tanks the Authors of those projects
and the Ndiswrapper project Authors.
*/
@@ -20,7 +20,7 @@
#ifndef R8180_HW
#define R8180_HW
-#define MAX_SLEEP_TIME (10000000)
+#define MAX_SLEEP_TIME (10000000)
#define MIN_SLEEP_TIME (50000)
#define RTL8187_RF_INDEX 0x8225
@@ -80,7 +80,7 @@
#define EPROM_CMD_OPERATING_MODE_SHIFT 6
#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6))
#define EPROM_CMD_CONFIG 0x3
-#define EPROM_CMD_NORMAL 0
+#define EPROM_CMD_NORMAL 0
#define EPROM_CMD_LOAD 1
#define EPROM_CMD_PROGRAM 2
#define EPROM_CS_SHIFT 3
@@ -193,8 +193,8 @@
-/*
- * Operational registers offsets in PCI (I/O) space.
+/*
+ * Operational registers offsets in PCI (I/O) space.
* RealTek names are used.
*/
@@ -310,7 +310,7 @@
/* following are for rtl8185 */
#define RFPinsOutput 0x80
#define RFPinsEnable 0x82
-#define RF_TIMING 0x8c
+#define RF_TIMING 0x8c
#define RFPinsSelect 0x84
#define ANAPARAM2 0x60
#define RF_PARA 0x88
@@ -339,7 +339,7 @@
#define MIN_RESP_RATE_SHIFT 0
#define RATE_FALLBACK 0xbe
/*
- * 0x0084 - 0x00D3 is selected to page 1 when PSEn bit (bit0, PSR)
+ * 0x0084 - 0x00D3 is selected to page 1 when PSEn bit (bit0, PSR)
* is set to 1
*/
@@ -380,7 +380,7 @@
/*
- * 0x0084 - 0x00D3 is selected to page 0 when PSEn bit (bit0, PSR)
+ * 0x0084 - 0x00D3 is selected to page 0 when PSEn bit (bit0, PSR)
* is set to 0
*/
@@ -437,7 +437,7 @@
/*
- * Bitmasks for specific register functions.
+ * Bitmasks for specific register functions.
* Names are derived from the register name and function name.
*
* <REGISTER>_<FUNCTION>[<bit>]
@@ -501,7 +501,7 @@
#define TCR_HWVERID_SHIFT 25
#define TCR_SWPLCPLEN ((1<<24))
#define TCR_PLCP_LEN TCR_SAT // rtl8180
-#define TCR_MXDMA_MASK ((1<<23)|(1<<22)|(1<<21))
+#define TCR_MXDMA_MASK ((1<<23)|(1<<22)|(1<<21))
#define TCR_MXDMA_1024 6
#define TCR_MXDMA_2048 7
#define TCR_MXDMA_SHIFT 21
diff -Naur r8187_orig/rtl8187/r8180_rtl8225.h r8187_rawtx/rtl8187/r8180_rtl8225.h
--- r8187_orig/rtl8187/r8180_rtl8225.h 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/rtl8187/r8180_rtl8225.h 2007-05-16 21:51:38.000000000 +0200
@@ -48,4 +48,5 @@
extern u32 rtl8225_chan[];
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
#endif
diff -Naur r8187_orig/rtl8187/r8180_wx.c r8187_rawtx/rtl8187/r8180_wx.c
--- r8187_orig/rtl8187/r8180_wx.c 2007-03-02 04:22:29.000000000 +0100
+++ r8187_rawtx/rtl8187/r8180_wx.c 2007-05-16 21:51:33.000000000 +0200
@@ -21,7 +21,7 @@
#include "r8187.h"
#include "r8180_hw.h"
-
+#include "r8180_rtl8225.h"
//#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
@@ -121,22 +121,72 @@
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
}
+#endif
static int r8180_wx_set_rts(struct net_device *dev,
struct iw_request_info *info,
@@ -836,6 +886,7 @@
}
+#if 0
static int r8180_wx_radio_on(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
@@ -871,6 +922,7 @@
return 0;
}
+#endif
static int r8180_wx_set_channelplan(struct net_device *dev,
struct iw_request_info *info,
@@ -965,8 +1017,8 @@
r8180_wx_get_rts, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
@@ -1007,7 +1059,7 @@
},
{
SIOCIWFIRSTPRIV + 0x6,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ 0, 0, "dummy"
},
{ SIOCIWFIRSTPRIV + 0x7,
0, 0, "dummy"
@@ -1053,11 +1105,11 @@
},
{
SIOCIWFIRSTPRIV + 0x12,
- 0, 0, "radioon"
+ 0, 0, "dummy"
},
{
SIOCIWFIRSTPRIV + 0x13,
- 0, 0, "radiooff"
+ 0, 0, "dummy"
},
{
SIOCIWFIRSTPRIV + 0x14,
@@ -1089,7 +1141,7 @@
dummy,
r8180_wx_set_scan_type,
dummy,
- r8180_wx_set_rawtx,
+ dummy,
dummy,
r8180_wx_set_iwmode,
r8180_wx_get_iwmode,
@@ -1101,8 +1153,8 @@
r8180_wx_get_sigqual,
r8180_wx_reset_stats,
dummy,
- r8180_wx_radio_on,
- r8180_wx_radio_off,
+ dummy,
+ dummy,
r8180_wx_set_channelplan,
r8180_wx_get_channelplan,
dummy,
diff -Naur r8187_orig/rtl8187/r8187_core.c r8187_rawtx/rtl8187/r8187_core.c
--- r8187_orig/rtl8187/r8187_core.c 2007-03-28 08:39:13.000000000 +0200
+++ r8187_rawtx/rtl8187/r8187_core.c 2007-05-16 21:51:33.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -83,6 +83,10 @@
#define USB_VENDOR_ID_NETGEAR 0x0846
#endif
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
+
static struct usb_device_id rtl8187_usb_id_tbl[] = {
{USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)},
{USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)},
@@ -137,7 +141,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -161,10 +165,10 @@
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
+
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +177,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
+
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +189,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
+
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +201,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
+
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -225,20 +229,20 @@
u8 data;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -251,14 +255,14 @@
u32 data;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,8 +275,17 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
-void rtl8180_restart(struct net_device *dev);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_rq_tx_ack(struct work_struct *work);
+#else
void rtl8180_rq_tx_ack(struct net_device *dev);
+#endif
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
+void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -286,12 +299,12 @@
{
struct net_device *dev = data;
// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -308,7 +321,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -321,15 +334,15 @@
{
struct net_device *dev = data;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -341,12 +354,12 @@
{
struct net_device *dev = data;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+
int len = 0;
unsigned long totalOK;
totalOK=priv->stats.txnpokint+priv->stats.txhpokint+priv->stats.txlpokint;
-
+
len += snprintf(page + len, count - len,
/* "TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -363,7 +376,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -391,13 +404,13 @@
priv->stats.txerr,
priv->stats.txretry,
priv->stats.txbeaconok,
- priv->stats.txbeaconerr
+ priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -407,9 +420,9 @@
{
struct net_device *dev = data;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
/*"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -431,21 +444,22 @@
priv->stats.rxicverr
);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -477,8 +491,8 @@
{
struct proc_dir_entry *e;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -488,7 +502,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -497,17 +511,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -516,27 +530,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -552,14 +566,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -569,10 +583,10 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
@@ -600,9 +614,9 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
printk( "\nD: %2x> ", n);
@@ -619,11 +633,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -633,7 +647,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -657,27 +671,27 @@
{
struct r8180_priv *priv = ieee80211_priv(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
@@ -687,20 +701,20 @@
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
priv->rf_set_chan(dev,priv->chan);
@@ -715,25 +729,25 @@
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
- RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ RX_URB_SIZE,rtl8187_rx_isr, dev);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
@@ -741,30 +755,30 @@
{
int i;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
priv->tx_urb_index = 0;
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -772,40 +786,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -816,23 +830,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -842,36 +856,36 @@
u8 byte;
u32 txconf;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -879,23 +893,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -903,9 +920,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -923,13 +940,13 @@
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
@@ -946,7 +963,7 @@
u8 cmd;
int i;
struct r8180_priv *priv = ieee80211_priv(dev);
-
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -957,9 +974,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -971,13 +988,13 @@
int i;
u32 *tmp;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -986,7 +1003,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -996,15 +1013,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -1012,19 +1029,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1036,13 +1053,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1068,14 +1085,14 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
}
@@ -1089,49 +1106,49 @@
u16 N_DBPSOfRate(u16 DataRate)
{
u16 N_DBPS = 24;
-
+
switch(DataRate)
{
case 60:
N_DBPS = 24;
break;
-
+
case 90:
N_DBPS = 36;
break;
-
+
case 120:
N_DBPS = 48;
break;
-
+
case 180:
N_DBPS = 72;
break;
-
+
case 240:
N_DBPS = 96;
break;
-
+
case 360:
N_DBPS = 144;
break;
-
+
case 480:
N_DBPS = 192;
break;
-
+
case 540:
N_DBPS = 216;
break;
-
+
default:
break;
}
-
+
return N_DBPS;
}
-u16 ComputeTxTime(
+u16 ComputeTxTime(
u16 FrameLength,
u16 DataRate,
u8 bManagementFrame,
@@ -1146,7 +1163,7 @@
{
if( bManagementFrame || !bShortPreamble || DataRate == 10 )
{ // long preamble
- FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10)));
+ FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10)));
}
else
{ // Short preamble
@@ -1156,14 +1173,14 @@
FrameTime ++;
} else { //802.11g DSSS-OFDM PLCP length field calculation.
N_DBPS = N_DBPSOfRate(DataRate);
- Ceiling = (16 + 8*FrameLength + 6) / N_DBPS
+ Ceiling = (16 + 8*FrameLength + 6) / N_DBPS
+ (((16 + 8*FrameLength + 6) % N_DBPS) ? 1 : 0);
FrameTime = (u16)(16 + 4 + 4*Ceiling + 6);
}
return FrameTime;
}
-
+
#if 0
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
{
@@ -1172,7 +1189,7 @@
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#endif
@@ -1223,13 +1240,14 @@
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ morefrag = 1;
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1238,25 +1256,24 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
+ spin_lock_irqsave(&priv->tx_lock,flags);
+
//DMESG("TX");
if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
DMESG("Error: no TX slot ");
ieee80211_stop_queue(priv->ieee80211);
}
-
-
+
rtl8180_tx(dev, skb->data, skb->len, LOW_PRIORITY, morefrag,
ieeerate2rtlrate(rate));
priv->stats.txdatapkt++;
-
+
if (!check_nic_enought_desc(dev, LOW_PRIORITY))
ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1269,9 +1286,9 @@
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1281,9 +1298,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1296,7 +1313,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1305,7 +1322,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1313,30 +1330,30 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
@@ -1369,10 +1386,10 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
@@ -1382,21 +1399,21 @@
struct r8180_priv *priv = ieee80211_priv(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
@@ -1406,18 +1423,18 @@
struct r8180_priv *priv = ieee80211_priv(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
+
skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1427,7 +1444,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1438,7 +1455,7 @@
return ;
}
}
-
+
rtl8180_tx(dev, skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
@@ -1461,15 +1478,15 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
//u32 *tx;
- u8 *tx;
+ u8 *tx;
u8 *pdata;
u8 seg = ((u32)txbuf % 4);
u32 *pdata32;
@@ -1480,7 +1497,7 @@
int pend;
int status;
struct urb *tx_urb;
- int urb_len;
+ int urb_len;
u16 AckCtsTime;
u16 FrameTime;
u16 duration;
@@ -1498,20 +1515,20 @@
priv->stats.txlpdrop++;
return -1;
}
-
-#if 0
+
+#if 0
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
@@ -1519,7 +1536,7 @@
//urb_len = TX_URB_SIZE;
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx_urb = priv->tx_context[priv->tx_urb_index].tx_urb;
@@ -1527,7 +1544,7 @@
pdata = tx + 12;
priv->tx_urb_index = (priv->tx_urb_index + 1) % MAX_TX_URB;
#endif
-#if 0
+#if 0
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
@@ -1535,7 +1552,7 @@
// printk(KERN_INFO "preamble mode %d,rate %d!\n",priv->plcp_preamble_mode,rate);
if (priv->ieee80211->current_network.capability&WLAN_CAPABILITY_SHORT_PREAMBLE)
if (priv->plcp_preamble_mode==1 && rate!=0) { // short mode now, not long!
- tx[0] |= (1<<16);
+ tx[0] |= (1<<16);
// printk(KERN_INFO "use short preamble!\n");
} // enable short preamble mode.
@@ -1548,11 +1565,11 @@
AckCtsTime = ComputeTxTime(14, 10,0, 0); // AckCTSLng = 14 use 1M bps send
FrameTime = ComputeTxTime(len + 4, rtl8180_rate2rate(rate), 0, tx[0]&(1<<16));
// RTS/CTS time is calculate as follow
- duration = FrameTime + 3*10 + 2*AckCtsTime; //10us is the SifsTime;
+ duration = FrameTime + 3*10 + 2*AckCtsTime; //10us is the SifsTime;
tx[1] |= duration; //Need to edit here! ----hikaru
printk(KERN_INFO "duration %d!\n",duration);
}
- else
+ else
tx[1]=0;
//if(len > priv->rts_threshold){
// tx[0] |= (1<<23); //ENABLE RTS
@@ -1562,18 +1579,18 @@
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
// tx[1] = 0;
-
+
// duration = rtl8180_len2duration(len,
-// rate,&ext);
+// rate,&ext);
// tx[1] |= (duration & 0x7fff) <<16;
// if(ext) tx[1] |= (1<<31);
-
+
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1601,12 +1618,12 @@
}
#endif
//memcpy(pdata, txbuf, len);
-
+
//tx[0] = 0;
//tx[1] = 0;
tx[2] = 0;
tx[3] = 0;
-
+
//tx[0] |= len & 0xfff;
tx[0] = len & 0xff;
tx[1] = (len & 0x0f00) >> 8;
@@ -1614,25 +1631,25 @@
if (priv->ieee80211->current_network.capability&WLAN_CAPABILITY_SHORT_PREAMBLE)
if (priv->plcp_preamble_mode==1 && rate!=0) { // short mode now, not long!
- tx[2] |= 1;
+ tx[2] |= 1;
- }
+ }
if ( (len>priv->rts) && priv->rts && priority==LOW_PRIORITY){
tx[2] |= (1<<7); //enalbe RTS function
AckCtsTime = ComputeTxTime(14, 10,0, 0); // AckCTSLng = 14 use 1M bps send
FrameTime = ComputeTxTime(len + 4, rtl8180_rate2rate(rate), 0, tx[2]&1);
// RTS/CTS time is calculate as follow
- duration = FrameTime + 3*10 + 2*AckCtsTime; //10us is the SifsTime;
+ duration = FrameTime + 3*10 + 2*AckCtsTime; //10us is the SifsTime;
tx[4] |= duration & 0xff; //Need to edit here! ----hikaru
- tx[5] |= (duration & 0xff00) >> 8;
+ tx[5] |= (duration & 0xff00) >> 8;
printk(KERN_INFO "duration %d!\n",duration);
}
else {
tx[4] = 0;
tx[5] = 0;
}
-
+
if(morefrag) tx[2] |= (1<<1);
tx[2] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 3); /* RTS RATE - should be basic rate */
tx[3] |= rate;
@@ -1640,7 +1657,7 @@
tx[8] = 3; // CW min
tx[8] |= (7<<4); //CW max
tx[9] |= 11;//(priv->retry_data<<8); //retry lim
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
@@ -1662,7 +1679,7 @@
}
}
-
+
//void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
@@ -1671,70 +1688,70 @@
{
struct r8180_priv *priv = ieee80211_priv(dev);
int i,j;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
for(j=0; j < MAX_TX_URB; j++){
struct tx_urb_context *ptrcontext = &priv->tx_context[j];
u8 seg_size;
-
+
ptrcontext->tx_urb = usb_alloc_urb(0,GFP_KERNEL);
- if(!ptrcontext->tx_urb)
+ if(!ptrcontext->tx_urb)
goto destroy_tx;
-
+
ptrcontext->transfer_buffer = kmalloc(TX_URB_SIZE, GFP_KERNEL);
- if(!ptrcontext->transfer_buffer)
+ if(!ptrcontext->transfer_buffer)
goto destroy1_tx;
// set tx_urb 4 byte align
seg_size = (u32)ptrcontext->transfer_buffer % 4;
ptrcontext->ptalign_buf = ptrcontext->transfer_buffer + ((seg_size > 0)? (4 - seg_size):0);
}
-
+
return 0;
destroy1_tx:
usb_free_urb(priv->tx_context[j].tx_urb);
-
+
destroy_tx:
while (--j >= 0){
kfree(priv->tx_context[j].transfer_buffer);
usb_free_urb(priv->tx_context[j].tx_urb);
}
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
int i,j;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1743,12 +1760,12 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
//added by david. 2007.1.30
for(j=0; j < MAX_TX_URB; j++){
struct tx_urb_context *ptrcontext = &priv->tx_context[j];
-
+
usb_kill_urb(ptrcontext->tx_urb);
kfree(ptrcontext->transfer_buffer);
ptrcontext->transfer_buffer = NULL;
@@ -1763,16 +1780,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
+
// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+ //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1784,7 +1801,7 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
@@ -1797,7 +1814,7 @@
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
+
struct r8180_priv *priv = ieee80211_priv(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
@@ -1813,10 +1830,15 @@
#define HW_WAKE_DELAY 5
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_hw_wakeup(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, hw_wakeup_wq);
+ struct net_device *dev = ieee->dev;
+#else
void rtl8180_hw_wakeup(struct net_device *dev)
{
- //unsigned long flags;
-
+#endif
struct r8180_priv *priv = ieee80211_priv(dev);
printk(KERN_INFO "enter rtl8180_hw_wakeup!\n");
if (!priv->ps_sleep_finish) {
@@ -1829,7 +1851,7 @@
// spin_lock_irqsave(&priv->ps_lock,flags);
//DMESG("Waken up!");
// write_nic_byte(dev,CONFIG4,read_nic_byte(dev,CONFIG4)&~CONFIG4_PWRMGT);
-
+
if(priv->rf_wakeup)
priv->rf_wakeup(dev);
priv->ps_sleep_finish=0;
@@ -1853,19 +1875,32 @@
schedule_work(&priv->rtl8180_hw_wakeup_wq);
printk(KERN_INFO "timer wakup schedule!\n");
}
-void rtl8180_rq_tx_ack(struct net_device *dev){
-
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_rq_tx_ack(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ps_request_tx_ack_wq);
+ struct net_device *dev = ieee->dev;
+#else
+void rtl8180_rq_tx_ack(struct net_device *dev)
+{
+#endif
struct r8180_priv *priv = ieee80211_priv(dev);
// write_nic_byte(dev,CONFIG4,read_nic_byte(dev,CONFIG4)|CONFIG4_PWRMGT);
priv->ack_tx_to_ieee = 1;
// printk(KERN_INFO "rtl8180_rq_tx_ack!\n");
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_hw_sleep(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, hw_sleep_wq);
+ struct net_device *dev = ieee->dev;
+#else
void rtl8180_hw_sleep(struct net_device *dev)
{
-
+#endif
struct r8180_priv *priv = ieee80211_priv(dev);
-
u32 rb,tl;
//unsigned long flags;
u32 timeout;
@@ -1886,27 +1921,27 @@
rb = read_nic_dword(dev, TSFTR);
//// printk(KERN_INFO "enter rtl8180_hw_sleep!\n");
// spin_lock_irqsave(&priv->ps_lock,flags);
-
+
/* Writing HW register with 0 equals to disable
* the timer, that is not really what we want
*/
tl = priv->ieee80211->ps_tl;
// printk(KERN_INFO "tl is %lu!\n",tl);
tl -= HW_WAKE_DELAY*1000;
-
+
if(tl == 0) tl = 1;
-
+
/* FIXME HACK FIXME HACK */
// force_pci_posting(dev);
// mdelay(1);
-
+
// rb = read_nic_dword(dev, TSFTR);
#ifdef TONY_PS
printk(KERN_INFO "tl %lu, rb %lu!\n",tl,rb);
#endif
-
+
//DMESG("sleep until %x, hw @:%x",tl,rb);
-
+
/* If the interval in witch we are requested to sleep is too
* short then give up and remain awake
*/
@@ -1914,12 +1949,12 @@
if(((rb<tl)&& (tl-rb) < MIN_SLEEP_TIME)
||((rb>tl)&& (rb-tl) < MIN_SLEEP_TIME))
return;
-
+
// write_nic_dword(dev, TimerInt, tl);
//DMESG("sleep..");
// rb = read_nic_dword(dev, TSFTR);
-
- /* if we suspect the TimerInt is gone beyond tl
+
+ /* if we suspect the TimerInt is gone beyond tl
* while setting it, then give up
*/
if(((tl > rb) && ((tl-rb) > MAX_SLEEP_TIME))||
@@ -1927,29 +1962,29 @@
return;
if (rb>tl)
- timeout = (rb-tl)>>10;//divide by 1024
+ timeout = (rb-tl)>>10;//divide by 1024
else
- timeout = (tl-rb)>>10;
+ timeout = (tl-rb)>>10;
// if(priv->rf_sleep)
// priv->rf_sleep(dev);
priv->ps_timer.expires = jiffies+timeout;
//// printk(KERN_INFO "jiffies %lu, timeout %lu!\n",jiffies,timeout);
add_timer(&priv->ps_timer);
-
+
if(priv->rf_sleep)
priv->rf_sleep(dev);
priv->ps_sleep_finish=1;
// }
// up(&priv->power_sem);
-// spin_unlock_irqrestore(&priv->ps_lock,flags);
+// spin_unlock_irqrestore(&priv->ps_lock,flags);
printk(KERN_INFO "leave sleep!\n");
}
short rtl8180_is_tx_queue_empty(struct net_device *dev){
-
+
struct r8180_priv *priv = ieee80211_priv(dev);
-
+
int used;
#ifdef TONY_TRACK
DMESG("enter rtl8180_is_tx_queue_empty!\n");
@@ -1957,11 +1992,11 @@
used = atomic_read(&priv->tx_np_pending);
//// printk(KERN_INFO "np used %d!\n",used);
- if (used) return 0;
+ if (used) return 0;
used = atomic_read(&priv->tx_lp_pending);
//// printk(KERN_INFO "lp used %d!\n",used);
if (used) return 0;
-
+
return 1;
}
@@ -1969,7 +2004,7 @@
short rtl8180_init(struct net_device *dev)
{
-
+
struct r8180_priv *priv = ieee80211_priv(dev);
int i, j;
u16 word;
@@ -1977,16 +2012,16 @@
//u16 version;
//u8 hw_version;
//u8 config3;
-
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -2004,9 +2039,9 @@
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -2042,7 +2077,7 @@
priv->ps_sleep_finish=0;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
@@ -2050,11 +2085,19 @@
priv->ieee80211->mode = IEEE_G|IEEE_B; //2007.1.25
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
INIT_WORK(&priv->rtl8180_hw_wakeup_wq,(void(*)(void*))rtl8180_hw_wakeup,dev);
INIT_WORK(&priv->ieee80211->ps_request_tx_ack_wq,(void(*)(void*))rtl8180_rq_tx_ack,dev);
INIT_WORK(&priv->ieee80211->hw_wakeup_wq,(void(*)(void*))rtl8180_hw_wakeup,dev);
INIT_WORK(&priv->ieee80211->hw_sleep_wq,(void(*)(void*))rtl8180_hw_sleep,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+ INIT_WORK(&priv->rtl8180_hw_wakeup_wq, rtl8180_hw_wakeup);
+ INIT_WORK(&priv->ieee80211->ps_request_tx_ack_wq, rtl8180_rq_tx_ack);
+ INIT_WORK(&priv->ieee80211->hw_wakeup_wq, rtl8180_hw_wakeup);
+ INIT_WORK(&priv->ieee80211->hw_sleep_wq, rtl8180_hw_sleep);
+#endif
// INIT_WORK(&priv->ps_request_tx_ack_wq,(void(*)(void*))rtl8180_rq_tx_ack,dev);
sema_init(&priv->wx_sem,1);
sema_init(&priv->power_sem,1);
@@ -2068,17 +2111,17 @@
priv->ps_timer.data = (unsigned long)dev;
priv->ps_timer.function = timer_hw_wakeup_wq;
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -2100,51 +2143,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -2162,13 +2205,13 @@
priv->plcp_preamble_mode = 2;
-
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -2204,8 +2247,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -2213,58 +2256,67 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -2283,30 +2335,30 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
InitSwLeds(dev);
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -2320,16 +2372,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -2349,7 +2401,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -2369,23 +2421,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -2393,26 +2445,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -2442,26 +2494,26 @@
struct r8180_priv *priv = ieee80211_priv(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
LedControl8187(dev, LED_CTL_POWER_ON);
//write_nic_byte(dev,0x91,1);
//write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
@@ -2469,32 +2521,32 @@
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-/*
+/*
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
- write_nic_dword(dev,INT_TIMEOUT,0);
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2510,13 +2562,13 @@
//add for Led controll
write_nic_byte(dev,0x85,4);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2534,7 +2586,7 @@
{
int i;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2547,41 +2599,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2592,7 +2644,7 @@
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
-
+
return &priv->ieee80211->stats;
}
@@ -2602,20 +2654,20 @@
struct r8180_priv *priv = ieee80211_priv(dev);
priv->up=1;
-
+
//DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
+
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
ieee80211_softmac_start_protocol(priv->ieee80211);
//LedControl8187(dev, LED_CTL_SITE_SURVEY);
-
+
ieee80211_reset_queue(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
@@ -2630,12 +2682,12 @@
{
struct r8180_priv *priv = ieee80211_priv(dev);
int ret;
-
+
down(&priv->wx_sem);
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
@@ -2644,7 +2696,7 @@
struct r8180_priv *priv = ieee80211_priv(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
@@ -2653,15 +2705,15 @@
{
struct r8180_priv *priv = ieee80211_priv(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
LedControl8187(dev, LED_CTL_NO_LINK);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2671,18 +2723,18 @@
struct r8180_priv *priv = ieee80211_priv(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
return 0;
}
@@ -2692,7 +2744,7 @@
struct r8180_priv *priv = ieee80211_priv(dev);
if (priv->up == 0) return ;
-
+
ieee80211_softmac_stop_protocol(priv->ieee80211);
sema_init(&priv->power_sem,1);
//printk(KERN_WARNING "priv->power_semb %d!\n",priv->power_sem);
@@ -2701,14 +2753,20 @@
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
-
+#endif
down(&priv->wx_sem);
-
+
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
@@ -2718,16 +2776,16 @@
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2737,15 +2795,15 @@
{
struct r8180_priv *priv = ieee80211_priv(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2758,8 +2816,8 @@
int ret=-1;
down(&priv->wx_sem);
-
-
+
+
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
@@ -2771,7 +2829,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2792,9 +2850,9 @@
//u32 *desc;
u8 *desc;
u8 signal,quality,rate;
-
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2803,31 +2861,31 @@
.freq = IEEE80211_24GHZ_BAND,
};
-
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-#if 0
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
+
//stats.signal = (desc[1] & 0x7f00)>>8;
//stats.noise = desc[1] &0xff;
signal=(desc[1]& (0xff0000))>>16;
signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
-
+
quality=(desc[1] & (0xff));
-
+
rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
- // printk(KERN_INFO "rate is %d!\n",rate);
- stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
// printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
//stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
@@ -2835,35 +2893,35 @@
#endif
desc = rx_urb->transfer_buffer + len;
-
+
flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
-
+
if( flen <= rx_urb->actual_length){
-
+
//stats.signal = (desc[1] & 0x7f00)>>8;
//stats.noise = desc[1] &0xff;
signal=(desc[6]& 0xfe)>>1;
//signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
-
+
quality=desc[4] & 0xff;
-
+
//rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
rate=(desc[2] & 0xf0)>>4;
- // printk(KERN_INFO "rate is %d!\n",rate);
- stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
// printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
//stats.rate = desc[0] >> 20 & 0xf;
- stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
- stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
-
//calculate link quality begin
- if(!rtl8180_IsWirelessBMode(stats.rate) )
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
{ // OFDM rate.
if(signal>90)
signal=90;
else if(signal<25)
- signal=25;
+ signal=25;
signal = (90-signal)*100/65;
}
else
@@ -2871,7 +2929,7 @@
if(signal>95)
signal = 95;
else if(signal<30)
- signal = 30;
+ signal = 30;
signal =(95-signal )*100/65;
}
priv->wstats.qual.level = signal;
@@ -2879,30 +2937,35 @@
if(quality > 64)
priv ->wstats.qual.qual = 0;
else
- priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
- //and this value only appear when STA is associated to AP or
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
// STA is in IBSS mode
// printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
priv->wstats.qual.updated = 7;
- //calculate link quality end
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2913,7 +2976,7 @@
}
//LedControl8187(dev, LED_CTL_RX);
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2931,20 +2994,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-printk(KERN_WARNING "===> rtl8187_usb_probe()\n");
-
+printk(KERN_WARNING "===> rtl8187_usb_probe()\n");
+
dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
priv = ieee80211_priv(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2953,41 +3016,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
free_ieee80211(dev);
-
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2996,13 +3064,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
+
priv=ieee80211_priv(dev);
-
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -3046,11 +3114,11 @@
unsigned long flags;
short enough_desc;
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
ieee80211_wake_queue(priv->ieee80211);
}
diff -Naur r8187_orig/rtl8187/r8187.h r8187_rawtx/rtl8187/r8187.h
--- r8187_orig/rtl8187/r8187.h 2007-12-05 04:22:20.000000000 +0100
+++ r8187_rawtx/rtl8187/r8187.h 2007-05-16 21:51:38.000000000 +0200
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include "r8187_led.h"
#include "r8180_hw.h"
@@ -74,7 +79,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,7 +128,7 @@
unsigned long txdatapkt;
unsigned long rxok;
unsigned long rxretry;//retry number tony 20060601
- unsigned long rxcrcerrmin;//crc error (0-500)
+ unsigned long rxcrcerrmin;//crc error (0-500)
unsigned long rxcrcerrmid;//crc error (500-1000)
unsigned long rxcrcerrmax;//crc error (>1000)
unsigned long rxicverr;//ICV error
@@ -142,7 +147,7 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
@@ -151,12 +156,12 @@
short hw_plcp_len;
short plcp_preamble_mode; // 0:auto 1:short 2:long
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
spinlock_t ps_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -165,17 +170,20 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
u8 channel_plan; // it's the channel plan index
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
+ short prism_hdr;
struct timer_list ps_timer;
short PS_timeout;//when ps set on ,if tx timeout ,this will be set 1
-
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -185,7 +193,7 @@
struct semaphore wx_sem;
struct semaphore power_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -200,12 +208,12 @@
void (*rf_wakeup)(struct net_device *dev);
void (*rf_sleep)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
@@ -213,20 +221,20 @@
struct urb **rx_urb;
struct tx_urb_context tx_context[MAX_TX_URB];
short tx_urb_index;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -256,7 +264,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -270,15 +278,20 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
u16 rts;
u8 ps_sleep_finish;//1, finish hw sleep ,0 finish hw wakeup
-
+
struct work_struct reset_wq;
struct work_struct rtl8180_hw_wakeup_wq;
+// struct work_struct rtl8180_rq_tx_ack_wq;
+// struct work_struct rtl8180_hw_sleep_wq;
+
+ struct work_struct SwLed0WorkItemCallback_wq;
+
short ack_tx_to_ieee;
@@ -292,15 +305,15 @@
LED_STRATEGY_8187 LedStrategy;
u8 PsrValue;
struct work_struct Gpio0LedWorkItem;
- struct work_struct SwLed0WorkItem;
- struct work_struct SwLed1WorkItem;
-
+ struct work_struct SwLed0WorkItem;
+ struct work_struct SwLed1WorkItem;
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
diff -Naur r8187_orig/rtl8187/r8187_led.c r8187_rawtx/rtl8187/r8187_led.c
--- r8187_orig/rtl8187/r8187_led.c 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/rtl8187/r8187_led.c 2007-05-16 21:51:33.000000000 +0200
@@ -3,35 +3,35 @@
Module Name:
r8187_led.c
-
+
Abstract:
RTL8187 LED control functions
-
+
Major Change History:
When Who What
---------- --------------- -------------------------------
2006-09-07 Xiong Created
-
-Notes:
-
+
+Notes:
+
--*/
/*--------------------------Include File------------------------------------*/
#include "r8180_hw.h"
#include "r8187.h"
-#include "r8180_93cx6.h"
+#include "r8180_93cx6.h"
#include "r8187_led.h"
/**
*
-* Initialization function for Sw Leds controll.
-*
+* Initialization function for Sw Leds controll.
+*
* \param dev The net device for this driver.
* \return void.
*
-* Note:
-*
+* Note:
+*
*/
void
InitSwLeds(
@@ -49,7 +49,7 @@
DMESG("EEPROM Customer ID: %02X\n", priv->EEPROMCustomerID);
if(priv->CustomerID == RT_CID_DEFAULT)
- { // If we have not yet change priv->CustomerID in register,
+ { // If we have not yet change priv->CustomerID in register,
// we initialzie it from that of EEPROM with proper translation, 2006.07.03, by rcnjko.
switch(priv->EEPROMCustomerID)
{
@@ -57,19 +57,19 @@
case EEPROM_CID_RSVD1:
priv->CustomerID = RT_CID_DEFAULT;
break;
-
+
case EEPROM_CID_ALPHA0:
priv->CustomerID = RT_CID_8187_ALPHA0;
break;
-
+
case EEPROM_CID_SERCOMM_PS:
priv->CustomerID = RT_CID_8187_SERCOMM_PS;
break;
-
+
case EEPROM_CID_HW_LED:
priv->CustomerID = RT_CID_8187_HW_LED;
break;
-
+
default:
// Invalid value, so, we use default value instead.
priv->CustomerID = RT_CID_DEFAULT;
@@ -78,13 +78,13 @@
}
switch(priv->CustomerID)
{
- case RT_CID_DEFAULT:
+ case RT_CID_DEFAULT:
priv->LedStrategy = SW_LED_MODE0;
break;
-
+
case RT_CID_8187_ALPHA0:
priv->LedStrategy = SW_LED_MODE1;
- break;
+ break;
case RT_CID_8187_SERCOMM_PS:
priv->LedStrategy = SW_LED_MODE3;
@@ -98,27 +98,39 @@
priv->LedStrategy = SW_LED_MODE0;
break;
}
-
- InitLed8187(dev,
- &(priv->Gpio0Led),
- LED_PIN_GPIO0,
+
+ InitLed8187(dev,
+ &(priv->Gpio0Led),
+ LED_PIN_GPIO0,
Gpio0LedBlinkTimerCallback);
- INIT_WORK(&priv->Gpio0LedWorkItem,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&priv->Gpio0LedWorkItem,
(void(*)(void*))Gpio0LedWorkItemCallback, dev);
+#else
+ INIT_WORK(&priv->Gpio0LedWorkItem, Gpio0LedWorkItemCallback);
+#endif
InitLed8187(dev,
- &(priv->SwLed0),
- LED_PIN_LED0,
+ &(priv->SwLed0),
+ LED_PIN_LED0,
SwLed0BlinkTimerCallback);
- INIT_WORK(&priv->SwLed0WorkItem,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&priv->SwLed0WorkItem,
(void(*)(void*))SwLed0WorkItemCallback, dev);
+#else
+ INIT_WORK(&priv->SwLed0WorkItem, SwLed0WorkItemCallback);
+#endif
InitLed8187(dev,
- &(priv->SwLed1),
- LED_PIN_LED1,
+ &(priv->SwLed1),
+ LED_PIN_LED1,
SwLed1BlinkTimerCallback);
- INIT_WORK(&priv->SwLed1WorkItem,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&priv->SwLed1WorkItem,
(void(*)(void*))SwLed1WorkItemCallback, dev);
+#else
+ INIT_WORK(&priv->SwLed1WorkItem, SwLed1WorkItemCallback);
+#endif
}
void
@@ -135,7 +147,7 @@
void
InitLed8187(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed,
LED_PIN_8187 LedPin,
void * BlinkCallBackFunc)
@@ -157,7 +169,7 @@
void
DeInitLed8187(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed)
{
//PlatformCancelTimer(dev, &(pLed->BlinkTimer));
@@ -178,10 +190,10 @@
return;
/*
- if( priv->eRFPowerState != eRfOn &&
- (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX ||
- LedAction == LED_CTL_SITE_SURVEY ||
- LedAction == LED_CTL_LINK ||
+ if( priv->eRFPowerState != eRfOn &&
+ (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX ||
+ LedAction == LED_CTL_SITE_SURVEY ||
+ LedAction == LED_CTL_LINK ||
LedAction == LED_CTL_NO_LINK) )
{
return;
@@ -213,7 +225,7 @@
//
-// Description:
+// Description:
// Implement each led action for SW_LED_MODE0.
// This is default strategy.
//
@@ -261,7 +273,7 @@
case LED_CTL_NO_LINK:
pLed->CurrLedState = LED_OFF;
break;
-
+
case LED_CTL_POWER_ON:
pLed->CurrLedState = LED_POWER_ON_BLINK;
break;
@@ -297,10 +309,10 @@
{
pLed->bLedBlinkInProgress = 1;
if( pLed->bLedOn )
- pLed->BlinkingLedState = LED_OFF;
+ pLed->BlinkingLedState = LED_OFF;
else
- pLed->BlinkingLedState = LED_ON;
-
+ pLed->BlinkingLedState = LED_ON;
+
pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL;
add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
@@ -312,10 +324,10 @@
{
pLed->bLedBlinkInProgress = 1;
if( pLed->bLedOn )
- pLed->BlinkingLedState = LED_OFF;
+ pLed->BlinkingLedState = LED_OFF;
else
pLed->BlinkingLedState = LED_ON;
-
+
pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL;
add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
@@ -334,7 +346,7 @@
}
//
-// Description:
+// Description:
// Implement each led action for SW_LED_MODE1.
// For example, this is applied by ALPHA.
//
@@ -357,9 +369,9 @@
pLed0->BlinkTimes = 2;
pLed0->bLedBlinkInProgress = 1;
if( pLed0->bLedOn )
- pLed0->BlinkingLedState = LED_OFF;
+ pLed0->BlinkingLedState = LED_OFF;
else
- pLed0->BlinkingLedState = LED_ON;
+ pLed0->BlinkingLedState = LED_ON;
pLed0->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL;
add_timer(&(pLed0->BlinkTimer));
@@ -382,7 +394,7 @@
SwLedOff(dev, pLed0);
}
break;
-
+
case LED_CTL_POWER_ON:
pLed0->CurrLedState = LED_OFF;
SwLedOff(dev, pLed0);
@@ -407,7 +419,7 @@
pLed0->BlinkTimes = 10;
pLed0->bLedBlinkInProgress = 1;
if( pLed0->bLedOn )
- pLed0->BlinkingLedState = LED_OFF;
+ pLed0->BlinkingLedState = LED_OFF;
else
pLed0->BlinkingLedState = LED_ON;
@@ -423,9 +435,9 @@
}
//
-// Description:
-// Implement each led action for SW_LED_MODE2,
-// which is customized for AzWave 8187 minicard.
+// Description:
+// Implement each led action for SW_LED_MODE2,
+// which is customized for AzWave 8187 minicard.
// 2006.04.03, by rcnjko.
//
void
@@ -450,9 +462,9 @@
pLed->BlinkTimes = 2;
if( pLed->bLedOn )
- pLed->BlinkingLedState = LED_OFF;
+ pLed->BlinkingLedState = LED_OFF;
else
- pLed->BlinkingLedState = LED_ON;
+ pLed->BlinkingLedState = LED_ON;
pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL;
add_timer(&(pLed->BlinkTimer));
@@ -465,7 +477,7 @@
{
pLed->bLedBlinkInProgress = 1;
- //if( dev->MgntInfo.mAssoc ||
+ //if( dev->MgntInfo.mAssoc ||
// dev->MgntInfo.mIbss )
//{
pLed->CurrLedState = LED_SCAN_BLINK;
@@ -486,7 +498,7 @@
}
else
{
- pLed->BlinkingLedState = LED_ON;
+ pLed->BlinkingLedState = LED_ON;
pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_OFF_INTERVAL;
add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_OFF_INTERVAL);
@@ -498,7 +510,7 @@
{
pLed->CurrLedState = LED_SCAN_BLINK;
/*
- if( dev->MgntInfo.mAssoc ||
+ if( dev->MgntInfo.mAssoc ||
dev->MgntInfo.mIbss )
{
pLed->CurrLedState = LED_SCAN_BLINK;
@@ -522,14 +534,14 @@
if( pLed->bLedOn )
{
- pLed->BlinkingLedState = LED_OFF;
+ pLed->BlinkingLedState = LED_OFF;
pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_ON_INTERVAL;
add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_ON_INTERVAL);
}
else
{
- pLed->BlinkingLedState = LED_ON;
+ pLed->BlinkingLedState = LED_ON;
pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_OFF_INTERVAL;
add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_OFF_INTERVAL);
@@ -564,9 +576,9 @@
//
-// Description:
-// Implement each led action for SW_LED_MODE3,
-// which is customized for Sercomm Printer Server case.
+// Description:
+// Implement each led action for SW_LED_MODE3,
+// which is customized for Sercomm Printer Server case.
// 2006.04.21, by rcnjko.
//
void
@@ -591,9 +603,9 @@
pLed->BlinkTimes = 2;
if( pLed->bLedOn )
- pLed->BlinkingLedState = LED_OFF;
+ pLed->BlinkingLedState = LED_OFF;
else
- pLed->BlinkingLedState = LED_ON;
+ pLed->BlinkingLedState = LED_ON;
pLed->BlinkTimer.expires = jiffies + LED_CM3_BLINK_INTERVAL;
add_timer(&(pLed->BlinkTimer));
@@ -610,9 +622,9 @@
pLed->BlinkTimes = 10;
if( pLed->bLedOn )
- pLed->BlinkingLedState = LED_OFF;
+ pLed->BlinkingLedState = LED_OFF;
else
- pLed->BlinkingLedState = LED_ON;
+ pLed->BlinkingLedState = LED_ON;
pLed->BlinkTimer.expires = jiffies + LED_CM3_BLINK_INTERVAL;
add_timer(&(pLed->BlinkTimer));
@@ -729,18 +741,21 @@
}
}
-//
+//
// Callback fucntion of the workitem for SW LEDs.
// 2006.03.01, by rcnjko.
//
-void
-Gpio0LedWorkItemCallback(
- void * Context
- )
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void Gpio0LedWorkItemCallback(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, Gpio0LedWorkItem);
+ struct net_device *dev = priv->dev;
+#else
+void Gpio0LedWorkItemCallback(struct net_device *dev)
{
- struct net_device *dev = (struct net_device *)Context;
struct r8180_priv *priv = ieee80211_priv(dev);
- PLED_8187 pLed = &(priv->Gpio0Led);
+#endif
+ PLED_8187 pLed = &(priv->Gpio0Led);
if(priv->LedStrategy == SW_LED_MODE2)
SwLedCm2Blink(dev, pLed);
@@ -750,27 +765,31 @@
//LeaveCallbackOfRtWorkItem( &(usbdevice->Gpio0LedWorkItem) );
}
-void
-SwLed0WorkItemCallback(
- void * Context
- )
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void SwLed0WorkItemCallback(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, SwLed0WorkItem);
+ struct net_device *dev = priv->dev;
+#else
+void SwLed0WorkItemCallback(struct net_device *dev)
{
- struct net_device *dev = (struct net_device *)Context;
struct r8180_priv *priv = ieee80211_priv(dev);
-
+#endif
SwLedBlink(dev, &(priv->SwLed0));
//LeaveCallbackOfRtWorkItem( &(usbdevice->SwLed0WorkItem) );
}
-void
-SwLed1WorkItemCallback(
- void * Context
- )
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void SwLed1WorkItemCallback(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, SwLed1WorkItem);
+ struct net_device *dev = priv->dev;
+#else
+void SwLed1WorkItemCallback(struct net_device *dev)
{
- struct net_device *dev = (struct net_device *)Context;
struct r8180_priv *priv = ieee80211_priv(dev);
-
+#endif
SwLedBlink(dev, &(priv->SwLed1));
//LeaveCallbackOfRtWorkItem( &(usbdevice->SwLed1WorkItem) );
@@ -782,19 +801,19 @@
//
void
SwLedBlink(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed
)
{
u8 bStopBlinking = 0;
// Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == LED_ON )
+ if( pLed->BlinkingLedState == LED_ON )
{
SwLedOn(dev, pLed);
//DMESG("Blinktimes (%d): turn on\n", pLed->BlinkTimes);
- }
- else
+ }
+ else
{
SwLedOff(dev, pLed);
//DMESG("Blinktimes (%d): turn off\n", pLed->BlinkTimes);
@@ -828,40 +847,40 @@
}
pLed->BlinkTimes = 0;
- pLed->bLedBlinkInProgress = 0;
+ pLed->bLedBlinkInProgress = 0;
}
else
{
// Assign LED state to toggle.
- if( pLed->BlinkingLedState == LED_ON )
+ if( pLed->BlinkingLedState == LED_ON )
pLed->BlinkingLedState = LED_OFF;
- else
+ else
pLed->BlinkingLedState = LED_ON;
- // Schedule a timer to toggle LED state.
+ // Schedule a timer to toggle LED state.
switch( pLed->CurrLedState )
{
case LED_BLINK_NORMAL:
pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL;
- add_timer(&(pLed->BlinkTimer));
+ add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
break;
case LED_BLINK_SLOWLY:
pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL;
- add_timer(&(pLed->BlinkTimer));
+ add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
break;
case LED_BLINK_CM3:
pLed->BlinkTimer.expires = jiffies + LED_CM3_BLINK_INTERVAL;
- add_timer(&(pLed->BlinkTimer));
+ add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM3_BLINK_INTERVAL);
break;
default:
pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL;
- add_timer(&(pLed->BlinkTimer));
+ add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
break;
}
@@ -871,11 +890,11 @@
//
-// Implementation of LED blinking behavior for SwLedControlMode2.
+// Implementation of LED blinking behavior for SwLedControlMode2.
//
void
SwLedCm2Blink(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed
)
{
@@ -884,12 +903,12 @@
u8 bStopBlinking = 0;
// Change LED according to BlinkingLedState specified.
- if( pLed->BlinkingLedState == LED_ON )
+ if( pLed->BlinkingLedState == LED_ON )
{
SwLedOn(dev, pLed);
//DMESG("Blinktimes (%d): turn on\n", pLed->BlinkTimes);
- }
- else
+ }
+ else
{
SwLedOff(dev, pLed);
//DMESG("Blinktimes (%d): turn off\n", pLed->BlinkTimes);
@@ -899,13 +918,13 @@
pLed->BlinkTimes--;
switch(pLed->CurrLedState)
{
- case LED_BLINK_NORMAL:
+ case LED_BLINK_NORMAL:
if(pLed->BlinkTimes == 0)
{
bStopBlinking = 1;
}
break;
-/* CM2 scan blink and no link blind now not be supported
+/* CM2 scan blink and no link blind now not be supported
case LED_SCAN_BLINK:
if( (priv->mAssoc || priv->mIbss) && // Linked.
(!priv->bScanInProgress) && // Not in scan stage.
@@ -916,9 +935,9 @@
break;
case LED_NO_LINK_BLINK:
- //Revised miniCard Ad-hoc mode "Slow Blink" by Isaiah 2006-08-03
+ //Revised miniCard Ad-hoc mode "Slow Blink" by Isaiah 2006-08-03
//if( (priv->mAssoc || priv->mIbss) ) // Linked.
- if( priv->mAssoc)
+ if( priv->mAssoc)
{
bStopBlinking = 1;
}
@@ -950,28 +969,28 @@
}
*/
pLed->BlinkTimes = 0;
- pLed->bLedBlinkInProgress = 0;
+ pLed->bLedBlinkInProgress = 0;
}
else
{
// Assign LED state to toggle.
- if( pLed->BlinkingLedState == LED_ON )
+ if( pLed->BlinkingLedState == LED_ON )
pLed->BlinkingLedState = LED_OFF;
- else
+ else
pLed->BlinkingLedState = LED_ON;
- // Schedule a timer to toggle LED state.
+ // Schedule a timer to toggle LED state.
switch( pLed->CurrLedState )
{
case LED_BLINK_NORMAL:
pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL;
- add_timer(&(pLed->BlinkTimer));
+ add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
break;
case LED_BLINK_SLOWLY:
pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL;
- add_timer(&(pLed->BlinkTimer));
+ add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
break;
@@ -979,11 +998,11 @@
case LED_NO_LINK_BLINK:
if( pLed->bLedOn ) {
pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_ON_INTERVAL;
- add_timer(&(pLed->BlinkTimer));
+ add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_ON_INTERVAL);
} else {
pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_OFF_INTERVAL;
- add_timer(&(pLed->BlinkTimer));
+ add_timer(&(pLed->BlinkTimer));
//PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_OFF_INTERVAL);
}
break;
@@ -1000,7 +1019,7 @@
void
SwLedOn(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed
)
{
@@ -1032,7 +1051,7 @@
void
SwLedOff(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed
)
{
@@ -1060,5 +1079,5 @@
}
pLed->bLedOn = 0;
-}
+}
diff -Naur r8187_orig/rtl8187/r8187_led.h r8187_rawtx/rtl8187/r8187_led.h
--- r8187_orig/rtl8187/r8187_led.h 2007-01-15 03:00:37.000000000 +0100
+++ r8187_rawtx/rtl8187/r8187_led.h 2007-05-16 21:51:38.000000000 +0200
@@ -7,7 +7,7 @@
Abstract:
definitions and stuctures for rtl8187 led control.
-
+
Major Change History:
When Who What
---------- ------ ----------------------------------------------
@@ -127,14 +127,14 @@
void
InitLed8187(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed,
LED_PIN_8187 LedPin,
void * BlinkCallBackFunc);
void
DeInitLed8187(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed);
void
@@ -188,42 +188,37 @@
PLED_8187 pLed
);
-void
-Gpio0LedWorkItemCallback(
- void * Context
- );
-
-void
-SwLed0WorkItemCallback(
- void * Context
- );
-
-void
-SwLed1WorkItemCallback(
- void * Context
- );
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void SwLed0WorkItemCallback(struct work_struct *work);
+void SwLed1WorkItemCallback(struct work_struct *work);
+void Gpio0LedWorkItemCallback(struct work_struct *work);
+#else
+void SwLed0WorkItemCallback(struct net_device *dev);
+void SwLed1WorkItemCallback(struct net_device *dev);
+void Gpio0LedWorkItemCallback(struct net_device *dev);
+#endif
void
SwLedBlink(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed
);
void
SwLedCm2Blink(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed
);
void
SwLedOn(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed
);
void
SwLedOff(
- struct net_device *dev,
+ struct net_device *dev,
PLED_8187 pLed
);
diff -Naur r8187_orig/symvers r8187_rawtx/symvers
--- r8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ r8187_rawtx/symvers 2007-05-13 09:54:44.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd rtl8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
\ Kein Zeilenumbruch am Dateiende. |
Patch | aircrack-ng/patches/old/rtl8187_2.6.20.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_txpower/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/ieee80211.h 2007-02-26 03:05:07.691423532 +0100
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_txpower/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_93cx6.c 2007-02-26 03:05:03.241356403 +0100
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_txpower/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_hw.h 2007-02-26 03:05:07.761424588 +0100
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_txpower/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225.c 2007-02-26 03:05:03.311357459 +0100
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_txpower/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225.h 2007-02-26 03:05:07.811425342 +0100
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_txpower/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225z2.c 2007-02-26 03:05:03.371358364 +0100
@@ -129,7 +129,7 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 mode = priv->ieee80211->mode;
@@ -153,7 +153,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -280,7 +280,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -396,7 +396,7 @@
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int GainIdx;
// int GainSetting;
@@ -418,7 +418,10 @@
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
cck_power_level += priv->cck_txpwr_base;
@@ -489,9 +492,9 @@
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225z2_SetTXPowerLevel(dev, ch);
@@ -509,7 +512,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -581,7 +584,7 @@
#endif
void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
@@ -958,7 +961,7 @@
void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(priv->ieee80211->mode == IEEE_A)
{
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_txpower/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_wx.c 2007-02-26 03:05:03.371358364 +0100
@@ -21,6 +21,7 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
@@ -32,9 +33,9 @@
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -46,7 +47,7 @@
int *parms = (int *)b;
int bi = parms[0];
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
@@ -62,7 +63,7 @@
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
priv->ieee80211->force_associate = (parms[0] > 0);
@@ -75,9 +76,9 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -86,8 +87,8 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
@@ -97,27 +98,83 @@
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
+
+ up(&priv->wx_sem);
+
+ return ret;
+}
+
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ down(&priv->wx_sem);
+ wrqu->power.value = priv->chtxpwr_ofdm[1] + MIN_TX_POWER;
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
+ up(&priv->wx_sem);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
+ return 0;
+}
+
+#if 0
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i = 0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > MAX_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < MIN_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<=14;i++)
+ {
+ priv->chtxpwr[i] = wrqu->power.value + 1 - MIN_TX_POWER;
+ priv->chtxpwr_ofdm[i] = wrqu->power.value - MIN_TX_POWER;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
up(&priv->wx_sem);
return ret;
}
+#endif
static int r8180_wx_set_rawtx(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
+ ret = ieee80211_wx_set_rawtx_rtl7(priv->ieee80211, info, wrqu, extra);
up(&priv->wx_sem);
@@ -129,7 +186,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
@@ -157,12 +214,12 @@
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
rtl8187_set_rxconf(dev);
@@ -176,7 +233,7 @@
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -247,7 +304,7 @@
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
@@ -267,14 +324,14 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
if(!priv->up) return -1;
down(&priv->wx_sem);
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
up(&priv->wx_sem);
return ret;
@@ -286,13 +343,13 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(!priv->up) return -1;
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
up(&priv->wx_sem);
@@ -304,13 +361,13 @@
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
up(&priv->wx_sem);
return ret;
@@ -322,11 +379,11 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
@@ -338,11 +395,11 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
return ret;
@@ -352,8 +409,8 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
@@ -361,7 +418,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -381,7 +438,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,11 +454,11 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
up(&priv->wx_sem);
return ret;
@@ -413,9 +470,9 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
@@ -423,22 +480,22 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
static int r8180_wx_set_enc(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
up(&priv->wx_sem);
return ret;
@@ -448,7 +505,7 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
@@ -463,7 +520,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
down(&priv->wx_sem);
@@ -516,7 +573,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->retry.disabled = 0; /* can't be disabled */
@@ -542,7 +599,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
@@ -555,7 +612,7 @@
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short err = 0;
down(&priv->wx_sem);
@@ -624,7 +681,7 @@
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
@@ -666,7 +723,7 @@
#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_txpower/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8187_core.c 2007-02-26 03:05:03.381358515 +0100
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -98,6 +99,10 @@
#endif
static int channels = 0x3fff;
+#define DEBUG_EPROM
+#define DEBUG_REGISTERS
+#define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -158,11 +163,10 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -174,7 +178,7 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -186,7 +190,7 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -198,7 +202,7 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -211,7 +215,7 @@
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -223,7 +227,7 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -236,7 +240,7 @@
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -249,7 +253,7 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -271,7 +275,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,7 +293,7 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int len = 0;
int i,n;
@@ -319,7 +328,7 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int len = 0;
@@ -339,7 +348,7 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int len = 0;
@@ -391,7 +400,7 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int len = 0;
@@ -407,13 +416,14 @@
return len;
}
-
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
{
@@ -430,7 +440,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,7 +457,7 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dir_dev = create_proc_entry(dev->name,
S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
@@ -539,7 +549,7 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
@@ -549,7 +559,7 @@
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +571,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -575,9 +598,9 @@
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,7 +612,7 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
@@ -603,7 +626,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,7 +648,7 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
msr = read_nic_byte(dev, MSR);
@@ -653,7 +676,7 @@
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
@@ -670,20 +693,20 @@
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
// u8 *rx;
@@ -710,7 +733,7 @@
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
@@ -721,7 +744,7 @@
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
rxconf=read_nic_dword(dev,RX_CONF);
@@ -810,7 +833,7 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
@@ -889,7 +912,7 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -900,7 +923,7 @@
void rtl8180_
_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,7 +937,7 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
@@ -939,7 +962,7 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
sizeof(u32)*8*count,
@@ -1051,7 +1074,7 @@
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
@@ -1062,7 +1085,7 @@
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1101,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1114,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1128,17 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ {
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ morefrag = 1;
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1126,7 +1152,7 @@
//DMESG("TX");
if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
}
rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
@@ -1135,7 +1161,7 @@
priv->stats.txdatapkt++;
if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
spin_unlock_irqrestore(&priv->tx_lock,flags);
@@ -1148,7 +1174,7 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
@@ -1228,7 +1254,7 @@
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1259,7 +1285,7 @@
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
@@ -1283,13 +1309,13 @@
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
rtl8187_net_update(dev);
- skb = ieee80211_get_beacon(priv->ieee80211);
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
if(!skb){
@@ -1327,7 +1353,7 @@
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1353,7 +1379,7 @@
int status;
struct urb *tx_urb;
int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
@@ -1445,7 +1471,7 @@
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
@@ -1483,7 +1509,7 @@
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
if(priv->rx_urb){
@@ -1506,9 +1532,9 @@
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-// struct r8180_priv *priv = ieee80211_priv(dev);
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
@@ -1540,7 +1566,7 @@
{
// int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1554,13 +1580,13 @@
short rtl8180_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
+ u8 hw_version;
+ u8 config3;
//FIXME: these constants are placed in a bad pleace.
@@ -1580,6 +1606,13 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
@@ -1588,6 +1621,8 @@
//memcpy(priv->stats,0,sizeof(struct Stats));
//priv->irq_enabled=0;
+
+ priv->dev = dev;
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
@@ -1622,7 +1657,11 @@
priv->ieee80211->mode = IEEE_G;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
@@ -1716,6 +1755,12 @@
priv->enable_gpio0 = 0;
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
@@ -1807,6 +1852,12 @@
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
@@ -1988,7 +2039,7 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
@@ -2077,7 +2128,7 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
@@ -2135,7 +2186,7 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->ieee80211->stats;
}
@@ -2143,36 +2194,32 @@
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
- //DMESG("Bringing up iface");
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
@@ -2182,7 +2229,7 @@
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
@@ -2192,7 +2239,7 @@
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
@@ -2207,7 +2254,7 @@
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
@@ -2220,7 +2267,7 @@
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
return 0;
}
@@ -2228,23 +2275,28 @@
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
- ieee80211_softmac_stop_protocol(priv->ieee80211);
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
up(&priv->wx_sem);
@@ -2252,7 +2304,7 @@
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
@@ -2273,7 +2325,7 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
down(&priv->wx_sem);
@@ -2291,8 +2343,9 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
struct iwreq *wrq = (struct iwreq *)rq;
@@ -2300,7 +2353,7 @@
int ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2346,7 +2399,8 @@
if( flen <= rx_urb->actual_length){
- stats.signal = (desc[1] & 0x7f00)>>8;
+// stats.signal = (desc[1] & 0x7f00)>>8;
+ stats.signal = (desc[1] & 0xff00)>>8;
stats.noise = desc[1] &0xff;
stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
@@ -2368,7 +2422,9 @@
// priv->rxskb = skb;
// priv->tempstats = &stats;
- if(!ieee80211_rx(priv->ieee80211,
+
+ stats.signal -= stats.noise;
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2398,14 +2454,14 @@
//printk("===> rtl8187_usb_probe()\n");
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
SET_MODULE_OWNER(dev);
usb_set_intfdata(intf, dev);
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
priv->udev=udev;
@@ -2418,7 +2474,12 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
if (dev_alloc_name(dev, ifname) < 0){
@@ -2447,7 +2508,7 @@
fail:
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver load failed\n");
@@ -2464,7 +2525,7 @@
unregister_netdev(dev);
- priv=ieee80211_priv(dev);
+ priv=ieee80211_priv_rtl7(dev);
rtl8180_proc_remove_one(dev);
@@ -2478,12 +2539,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2556,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2569,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
spin_unlock_irqrestore(&priv->tx_lock,flags);
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2584,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_txpower/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8187.h 2007-02-26 03:05:07.891426549 +0100
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,10 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -148,7 +151,7 @@
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
+ short prism_hdr;
// struct timer_list scan_timer;
/*short scanpending;
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_txpower/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt.c 2007-02-26 03:05:15.811546022 +0100
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,10 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +41,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +64,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +81,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +106,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +131,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +162,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +189,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +208,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +220,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +230,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +250,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c 2007-02-26 03:05:15.821546173 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,20 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ #include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -59,7 +67,7 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -75,7 +83,7 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -105,7 +113,7 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
@@ -114,7 +122,7 @@
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +130,7 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +194,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +245,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +253,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +270,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +334,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +345,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,7 +373,7 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
@@ -396,7 +404,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +428,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +445,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_txpower/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt.h 2007-02-26 03:05:12.091489906 +0100
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c 2007-02-26 03:05:15.841546474 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,22 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -62,7 +70,7 @@
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -101,7 +109,7 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
if (_priv && _priv->tfm_michael)
@@ -200,7 +208,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +230,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +276,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -283,11 +291,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -325,7 +333,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -382,10 +390,10 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
@@ -428,10 +436,14 @@
}
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+ struct hash_desc desc;
+#endif
struct scatterlist sg[2];
+ int ret=0;
if (tkey->tfm_michael == NULL) {
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
@@ -445,15 +457,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
+#else
+ if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
+ return -1;
- return 0;
+ desc.tfm = tkey->tfm_michael;
+ desc.flags = 0;
+ ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
+
+ return ret;
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +504,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,9 +516,9 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
@@ -506,7 +527,7 @@
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +548,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +564,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +572,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,8 +581,8 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
@@ -572,7 +593,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,7 +609,7 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
@@ -618,7 +639,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +669,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +696,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c 2007-02-26 03:05:15.881547078 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,22 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -40,7 +48,7 @@
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -72,7 +80,7 @@
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
if (_priv && _priv->tfm)
@@ -87,7 +95,7 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, len;
@@ -151,7 +159,7 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
@@ -203,7 +211,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +225,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +238,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +247,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_txpower/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211.h 2007-02-26 03:05:12.121490358 +0100
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_txpower/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_module.c 2007-02-26 03:05:15.911547530 +0100
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,10 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +63,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +83,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +91,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +102,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +116,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +141,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +152,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +170,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +178,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +194,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +213,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +246,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +271,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +285,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_txpower/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_rx.c 2007-02-26 03:05:15.941547983 +0100
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,83 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +128,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +158,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +197,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +210,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +220,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +242,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,8 +251,8 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
@@ -253,7 +317,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +358,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +368,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +403,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +413,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +431,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -444,7 +508,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -483,7 +547,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +565,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +593,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +619,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -575,7 +639,7 @@
#endif
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -606,7 +670,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +683,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +694,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +728,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +738,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +758,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +786,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +827,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +960,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +977,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1028,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1055,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1078,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1147,7 +1211,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,7 +1219,7 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
@@ -1172,7 +1236,7 @@
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1204,7 +1268,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1303,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1262,11 +1326,11 @@
spin_lock_irqsave(&ieee->lock, flags);
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1370,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1321,15 +1385,15 @@
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
@@ -1339,7 +1403,7 @@
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1347,7 +1411,7 @@
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1419,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_txpower/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_softmac.c 2007-02-26 03:05:15.981548586 +0100
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,7 +34,7 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
@@ -52,7 +52,7 @@
* Then it updates the pointer so that
* it points after the new MFIE tag added.
*/
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
u8 *tag = *tag_p;
@@ -69,7 +69,7 @@
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
u8 *tag = *tag_p;
@@ -92,7 +92,7 @@
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
@@ -110,7 +110,7 @@
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
@@ -125,15 +125,15 @@
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
@@ -144,13 +144,13 @@
spin_lock_irqsave(&ieee->lock, flags);
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
if(single){
if(ieee->queue_stop){
- enqueue_mgmt(ieee,skb);
+ enqueue_mgmt_rtl7(ieee,skb);
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -184,7 +184,7 @@
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
@@ -219,7 +219,7 @@
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
@@ -228,7 +228,7 @@
len = ieee->current_network.ssid_len;
- rate_len = ieee80211_MFIE_rate_len(ieee);
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
@@ -251,21 +251,21 @@
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
unsigned long flags;
- skb = ieee80211_get_beacon_(ieee);
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
@@ -279,37 +279,37 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
- skb = ieee80211_probe_req(ieee);
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
* in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
@@ -349,7 +349,7 @@
ieee->set_chan(ieee->dev, ch);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
@@ -384,11 +384,17 @@
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
+ down(&ieee->scan_sem);
do{
ieee->current_network.channel =
@@ -402,7 +408,7 @@
goto out;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,25 +459,25 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
// unsigned long flags;
@@ -490,22 +496,22 @@
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
@@ -513,18 +519,18 @@
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
struct sk_buff *skb;
@@ -557,7 +563,7 @@
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -578,7 +584,7 @@
else
atim_len = 0;
- if(ieee80211_is_54g(ieee->current_network))
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
@@ -664,7 +670,7 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
@@ -673,7 +679,7 @@
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
skb = dev_alloc_skb(len);
@@ -711,13 +717,13 @@
tag = (u8*) skb_put(skb, rate_len);
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
@@ -744,7 +750,7 @@
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
@@ -770,35 +776,35 @@
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
@@ -807,7 +813,7 @@
unsigned int wpa_len = beacon->wpa_ie_len;
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
@@ -848,8 +854,8 @@
tag = skb_put(skb, rate_len);
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
tag = skb_put(skb,wpa_len);
@@ -858,7 +864,7 @@
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -887,13 +893,13 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
@@ -901,20 +907,20 @@
IEEE80211_DEBUG_MGMT("Stopping scan\n");
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
u8 *c;
struct sk_buff *skb;
@@ -924,9 +930,9 @@
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
@@ -935,16 +941,16 @@
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
@@ -954,20 +960,26 @@
IEEE80211_DEBUG_MGMT("Sending association request\n");
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
@@ -977,13 +989,13 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
@@ -995,24 +1007,29 @@
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
- ieee80211_stop_scan(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
+ ieee80211_associate_step1_rtl7(ieee);
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
@@ -1079,7 +1096,7 @@
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1095,14 +1112,13 @@
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct ieee80211_network *target;
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
/* if the state become different that NOLINK means
@@ -1112,7 +1128,7 @@
break;
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -1120,7 +1136,7 @@
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
@@ -1145,7 +1161,7 @@
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
@@ -1163,7 +1179,7 @@
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
@@ -1201,7 +1217,7 @@
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
@@ -1219,7 +1235,7 @@
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
@@ -1233,45 +1249,45 @@
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
//unsigned long flags;
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
@@ -1285,18 +1301,18 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
{
int timeout = ieee->ps_timeout;
u8 dtim;
@@ -1343,7 +1359,7 @@
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
@@ -1360,12 +1376,12 @@
#warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_wakeup(ieee, 1);
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
@@ -1386,7 +1402,7 @@
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee,1);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
ieee->ps_th = th;
ieee->ps_tl = tl;
@@ -1400,7 +1416,7 @@
#warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_wakeup(ieee,1);
+ ieee80211_sta_wakeup_rtl7(ieee,1);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
@@ -1410,13 +1426,13 @@
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
@@ -1429,11 +1445,11 @@
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
@@ -1454,7 +1470,7 @@
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,17 +1478,18 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
@@ -1496,19 +1513,19 @@
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
- ieee80211_associate_complete(ieee);
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
@@ -1519,7 +1536,7 @@
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_rx_assoc_rq(ieee, skb);
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
case IEEE80211_STYPE_AUTH:
@@ -1530,23 +1547,23 @@
IEEE80211_DEBUG_MGMT("Received authentication response");
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
- ieee80211_associate_step2(ieee);
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
@@ -1558,7 +1575,7 @@
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
- ieee80211_rx_probe_rq(ieee, skb);
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
case IEEE80211_STYPE_DISASSOC:
@@ -1573,8 +1590,8 @@
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
@@ -1610,7 +1627,7 @@
* to the driver later, when it wakes the queue.
*/
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
@@ -1643,7 +1660,7 @@
#endif
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
@@ -1662,7 +1679,7 @@
}
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
@@ -1670,7 +1687,7 @@
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
@@ -1690,19 +1707,19 @@
}
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,7 +1727,7 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -1723,7 +1740,7 @@
ieee->queue_stop = 0;
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
header = (struct ieee80211_hdr_3addr *) skb->data;
@@ -1738,7 +1755,7 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
+ ieee80211_resume_tx_rtl7(ieee);
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
@@ -1750,7 +1767,7 @@
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1765,7 +1782,7 @@
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
@@ -1778,7 +1795,7 @@
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
@@ -1796,7 +1813,7 @@
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
@@ -1804,7 +1821,7 @@
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
@@ -1814,8 +1831,15 @@
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
@@ -1834,7 +1858,7 @@
}
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
@@ -1851,13 +1875,13 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
+ ieee80211_randomize_cell_rtl7(ieee);
if(ieee->modulation & IEEE80211_CCK_MODULATION){
@@ -1901,9 +1925,9 @@
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
- ieee80211_start_send_beacons(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
@@ -1913,13 +1937,13 @@
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,7 +1951,7 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
@@ -1937,34 +1961,42 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
+ ieee80211_start_scan_rtl7(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
+ ieee80211_reset_queue_rtl7(ieee);
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
@@ -1986,12 +2018,12 @@
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
spin_lock_irqsave(&ieee->lock, flags);
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
+ ieee80211_start_scan_rtl7(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -1999,14 +2031,14 @@
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
struct sk_buff *skb;
struct ieee80211_probe_response *b;
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
if (!skb)
return NULL;
@@ -2018,12 +2050,12 @@
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
- skb = ieee80211_get_beacon_(ieee);
+ skb = ieee80211_get_beacon__rtl7(ieee);
if(!skb)
return NULL;
@@ -2038,44 +2070,44 @@
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
ieee->proto_started = 0;
- ieee80211_stop_send_beacons(ieee);
+ ieee80211_stop_send_beacons_rtl7(ieee);
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
- ieee80211_stop_scan(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
@@ -2094,9 +2126,7 @@
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2109,21 +2139,18 @@
*/
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
@@ -2143,7 +2170,7 @@
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
@@ -2153,25 +2180,34 @@
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
@@ -2179,12 +2215,12 @@
spin_lock_init(&ieee->beacon_lock);
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
@@ -2201,7 +2237,7 @@
********************************************************/
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2211,16 +2247,16 @@
}
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
int ret = 0;
@@ -2231,7 +2267,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2279,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,14 +2303,14 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
struct ieee80211_security sec = {
@@ -2300,13 +2336,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2387,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,7 +2404,7 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
@@ -2407,7 +2443,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2457,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2478,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2561,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2552,20 +2588,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2585,7 +2621,7 @@
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2633,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c 2007-02-26 03:05:16.011549039 +0100
@@ -18,7 +18,7 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
+const long ieee80211_wlan_frequencies_rtl7[] = {
2412, 2417, 2422, 2427,
2432, 2437, 2442, 2447,
2452, 2457, 2462, 2467,
@@ -26,7 +26,7 @@
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
@@ -46,7 +46,7 @@
int f = fwrq->m / 100000;
int c = 0;
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
/* hack to fall through */
@@ -68,8 +68,8 @@
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -95,7 +95,7 @@
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -124,7 +124,7 @@
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
@@ -134,14 +134,14 @@
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
@@ -154,7 +154,7 @@
}
if (ifup)
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
/* just to avoid to give inconsistent infos in the
* get wx method. not really needed otherwise
@@ -167,14 +167,14 @@
spin_unlock_irqrestore(&ieee->lock, flags);
if (ifup)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
return ret;
}
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
@@ -209,7 +209,7 @@
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -223,7 +223,7 @@
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -233,7 +233,7 @@
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -245,8 +245,7 @@
goto out;
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
@@ -254,9 +253,9 @@
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
}
out:
@@ -264,8 +263,14 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
short chan;
chan = ieee->current_network.channel;
@@ -275,12 +280,12 @@
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
- ieee80211_stop_send_beacons(ieee);
+ ieee80211_stop_send_beacons_rtl7(ieee);
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
ieee->set_chan(ieee->dev, chan);
@@ -291,7 +296,7 @@
ieee->data_hard_resume(ieee->dev);
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
netif_carrier_on(ieee->dev);
@@ -299,7 +304,7 @@
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
@@ -322,7 +327,7 @@
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
@@ -348,7 +353,7 @@
}
if(proto_started)
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
@@ -371,13 +376,13 @@
spin_unlock_irqrestore(&ieee->lock, flags);
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,7 +390,7 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -422,7 +427,7 @@
return 0;
}
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -446,7 +451,7 @@
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -509,7 +514,7 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -547,19 +552,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_txpower/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_tx.c 2007-02-26 03:05:16.011549039 +0100
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,10 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +158,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +181,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +228,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +238,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +270,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -397,7 +400,7 @@
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -432,7 +435,7 @@
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
@@ -446,7 +449,7 @@
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
@@ -458,13 +461,14 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -481,14 +485,14 @@
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
@@ -504,4 +508,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_txpower/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_wx.c 2007-02-26 03:05:16.071549944 +0100
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -281,7 +282,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +292,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +315,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +327,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -418,7 +419,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -470,6 +471,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7); |
Patch | aircrack-ng/patches/old/rtl8187_2.6.20v2.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_txpower/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/ieee80211.h 2007-03-05 00:31:41.255175682 +0100
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_txpower/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_93cx6.c 2007-03-05 00:31:37.815123790 +0100
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_txpower/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_hw.h 2007-03-05 00:31:41.295176286 +0100
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_txpower/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225.c 2007-03-05 00:31:37.935125600 +0100
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_txpower/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225.h 2007-03-05 00:31:41.435178397 +0100
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_txpower/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_rtl8225z2.c 2007-03-05 00:31:38.025126958 +0100
@@ -129,7 +129,7 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 mode = priv->ieee80211->mode;
@@ -153,7 +153,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -280,7 +280,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -396,7 +396,7 @@
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int GainIdx;
// int GainSetting;
@@ -418,7 +418,10 @@
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
cck_power_level += priv->cck_txpwr_base;
@@ -489,9 +492,9 @@
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225z2_SetTXPowerLevel(dev, ch);
@@ -509,7 +512,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -581,7 +584,7 @@
#endif
void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
@@ -958,7 +961,7 @@
void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(priv->ieee80211->mode == IEEE_A)
{
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_txpower/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8180_wx.c 2007-03-05 00:31:38.045127259 +0100
@@ -21,6 +21,7 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
@@ -32,9 +33,9 @@
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -46,7 +47,7 @@
int *parms = (int *)b;
int bi = parms[0];
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
@@ -62,7 +63,7 @@
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
priv->ieee80211->force_associate = (parms[0] > 0);
@@ -75,9 +76,9 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -86,8 +87,8 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
@@ -97,27 +98,83 @@
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
+
+ up(&priv->wx_sem);
+
+ return ret;
+}
+
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ down(&priv->wx_sem);
+ wrqu->power.value = priv->chtxpwr_ofdm[1] + MIN_TX_POWER;
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
+ up(&priv->wx_sem);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
+ return 0;
+}
+
+#if 0
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i = 0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > MAX_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < MIN_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<=14;i++)
+ {
+ priv->chtxpwr[i] = wrqu->power.value + 1 - MIN_TX_POWER;
+ priv->chtxpwr_ofdm[i] = wrqu->power.value - MIN_TX_POWER;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
up(&priv->wx_sem);
return ret;
}
+#endif
static int r8180_wx_set_rawtx(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
+ ret = ieee80211_wx_set_rawtx_rtl7(priv->ieee80211, info, wrqu, extra);
up(&priv->wx_sem);
@@ -129,7 +186,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
@@ -157,12 +214,12 @@
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
rtl8187_set_rxconf(dev);
@@ -176,7 +233,7 @@
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -247,7 +304,7 @@
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
@@ -267,14 +324,14 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
if(!priv->up) return -1;
down(&priv->wx_sem);
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
up(&priv->wx_sem);
return ret;
@@ -286,13 +343,13 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(!priv->up) return -1;
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
up(&priv->wx_sem);
@@ -304,13 +361,13 @@
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
up(&priv->wx_sem);
return ret;
@@ -322,11 +379,11 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
@@ -338,11 +395,11 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
return ret;
@@ -352,8 +409,8 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
@@ -361,7 +418,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -381,7 +438,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,11 +454,11 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
down(&priv->wx_sem);
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
up(&priv->wx_sem);
return ret;
@@ -413,9 +470,9 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
@@ -423,22 +480,22 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
static int r8180_wx_set_enc(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
up(&priv->wx_sem);
return ret;
@@ -448,7 +505,7 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
@@ -463,7 +520,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
down(&priv->wx_sem);
@@ -516,7 +573,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->retry.disabled = 0; /* can't be disabled */
@@ -542,7 +599,7 @@
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
@@ -555,7 +612,7 @@
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short err = 0;
down(&priv->wx_sem);
@@ -624,7 +681,7 @@
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
@@ -666,7 +723,7 @@
#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_txpower/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8187_core.c 2007-03-05 00:31:38.115128315 +0100
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -98,6 +99,10 @@
#endif
static int channels = 0x3fff;
+#define DEBUG_EPROM
+#define DEBUG_REGISTERS
+#define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -158,11 +163,10 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -174,7 +178,7 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -186,7 +190,7 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -198,7 +202,7 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -211,7 +215,7 @@
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -223,7 +227,7 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -236,7 +240,7 @@
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -249,7 +253,7 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -271,7 +275,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,7 +293,7 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int len = 0;
int i,n;
@@ -319,7 +328,7 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int len = 0;
@@ -339,7 +348,7 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int len = 0;
@@ -391,7 +400,7 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int len = 0;
@@ -407,13 +416,14 @@
return len;
}
-
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
{
@@ -430,7 +440,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,7 +457,7 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dir_dev = create_proc_entry(dev->name,
S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
@@ -539,7 +549,7 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
@@ -549,7 +559,7 @@
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +571,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -575,9 +598,9 @@
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,7 +612,7 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
@@ -603,7 +626,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,7 +648,7 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
msr = read_nic_byte(dev, MSR);
@@ -653,7 +676,7 @@
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
@@ -670,20 +693,20 @@
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
// u8 *rx;
@@ -710,7 +733,7 @@
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
@@ -721,7 +744,7 @@
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
rxconf=read_nic_dword(dev,RX_CONF);
@@ -810,7 +833,7 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
@@ -889,7 +912,7 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -900,7 +923,7 @@
void rtl8180_
_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,7 +937,7 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
@@ -939,7 +962,7 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
sizeof(u32)*8*count,
@@ -1051,7 +1074,7 @@
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
@@ -1062,7 +1085,7 @@
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1101,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1114,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1128,17 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ {
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ morefrag = 1;
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1126,7 +1152,7 @@
//DMESG("TX");
if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
}
rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
@@ -1135,7 +1161,7 @@
priv->stats.txdatapkt++;
if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
spin_unlock_irqrestore(&priv->tx_lock,flags);
@@ -1148,7 +1174,7 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
@@ -1228,7 +1254,7 @@
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1259,7 +1285,7 @@
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
@@ -1283,13 +1309,13 @@
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
rtl8187_net_update(dev);
- skb = ieee80211_get_beacon(priv->ieee80211);
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
if(!skb){
@@ -1327,7 +1353,7 @@
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1353,7 +1379,7 @@
int status;
struct urb *tx_urb;
int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
@@ -1445,7 +1471,7 @@
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
@@ -1483,7 +1509,7 @@
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
if(priv->rx_urb){
@@ -1506,9 +1532,9 @@
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-// struct r8180_priv *priv = ieee80211_priv(dev);
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
@@ -1532,7 +1558,7 @@
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
@@ -1540,7 +1566,7 @@
{
// int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1554,13 +1580,13 @@
short rtl8180_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
+ u8 hw_version;
+ u8 config3;
//FIXME: these constants are placed in a bad pleace.
@@ -1580,6 +1606,13 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
@@ -1588,6 +1621,8 @@
//memcpy(priv->stats,0,sizeof(struct Stats));
//priv->irq_enabled=0;
+
+ priv->dev = dev;
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
@@ -1622,7 +1657,11 @@
priv->ieee80211->mode = IEEE_G;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
@@ -1716,6 +1755,12 @@
priv->enable_gpio0 = 0;
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
@@ -1807,6 +1852,12 @@
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
@@ -1988,7 +2039,7 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
@@ -2077,7 +2128,7 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
@@ -2135,7 +2186,7 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->ieee80211->stats;
}
@@ -2143,36 +2194,32 @@
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
- //DMESG("Bringing up iface");
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
@@ -2182,7 +2229,7 @@
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
@@ -2192,7 +2239,7 @@
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
down(&priv->wx_sem);
@@ -2207,7 +2254,7 @@
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
@@ -2220,7 +2267,7 @@
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
return 0;
}
@@ -2228,23 +2275,28 @@
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
- ieee80211_softmac_stop_protocol(priv->ieee80211);
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
up(&priv->wx_sem);
@@ -2252,7 +2304,7 @@
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
@@ -2273,7 +2325,7 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
down(&priv->wx_sem);
@@ -2291,8 +2343,9 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
struct iwreq *wrq = (struct iwreq *)rq;
@@ -2300,7 +2353,7 @@
int ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2346,7 +2399,8 @@
if( flen <= rx_urb->actual_length){
- stats.signal = (desc[1] & 0x7f00)>>8;
+// stats.signal = (desc[1] & 0x7f00)>>8;
+ stats.signal = (desc[1] & 0xff00)>>8;
stats.noise = desc[1] &0xff;
stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
@@ -2368,7 +2422,9 @@
// priv->rxskb = skb;
// priv->tempstats = &stats;
- if(!ieee80211_rx(priv->ieee80211,
+
+ stats.signal -= stats.noise;
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2398,14 +2454,14 @@
//printk("===> rtl8187_usb_probe()\n");
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
SET_MODULE_OWNER(dev);
usb_set_intfdata(intf, dev);
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
priv->udev=udev;
@@ -2418,7 +2474,12 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
if (dev_alloc_name(dev, ifname) < 0){
@@ -2447,7 +2508,7 @@
fail:
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver load failed\n");
@@ -2464,7 +2525,7 @@
unregister_netdev(dev);
- priv=ieee80211_priv(dev);
+ priv=ieee80211_priv_rtl7(dev);
rtl8180_proc_remove_one(dev);
@@ -2478,12 +2539,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2556,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2569,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
spin_unlock_irqrestore(&priv->tx_lock,flags);
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2584,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_txpower/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
+++ rtl8187_txpower/beta-8187/r8187.h 2007-03-05 00:31:41.535179906 +0100
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,10 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -148,7 +151,7 @@
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
+ short prism_hdr;
// struct timer_list scan_timer;
/*short scanpending;
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_txpower/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt.c 2007-03-05 00:31:52.275341919 +0100
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,10 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +41,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +64,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +81,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +106,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +131,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +162,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +189,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +208,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +220,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +230,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +250,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c 2007-03-05 00:31:52.295342221 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,20 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ #include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -59,7 +67,7 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -75,7 +83,7 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -105,7 +113,7 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
@@ -114,7 +122,7 @@
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +130,7 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +194,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +245,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +253,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +270,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +334,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +345,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,7 +373,7 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
@@ -396,7 +404,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +428,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +445,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_txpower/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt.h 2007-03-05 00:31:49.235296061 +0100
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c 2007-03-05 00:31:52.355343126 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,22 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -62,7 +70,7 @@
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -101,7 +109,7 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
if (_priv && _priv->tfm_michael)
@@ -200,7 +208,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +230,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +276,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -283,11 +291,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -325,7 +333,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -382,10 +390,10 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
@@ -428,10 +436,14 @@
}
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+ struct hash_desc desc;
+#endif
struct scatterlist sg[2];
+ int ret=0;
if (tkey->tfm_michael == NULL) {
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
@@ -445,15 +457,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
+#else
+ if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
+ return -1;
- return 0;
+ desc.tfm = tkey->tfm_michael;
+ desc.flags = 0;
+ ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
+
+ return ret;
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +504,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,9 +516,9 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
@@ -506,7 +527,7 @@
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +548,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +564,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +572,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,8 +581,8 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
@@ -572,7 +593,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,7 +609,7 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
@@ -618,7 +639,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +669,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +696,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c 2007-03-05 00:31:52.395343729 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,22 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -40,7 +48,7 @@
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -72,7 +80,7 @@
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
if (_priv && _priv->tfm)
@@ -87,7 +95,7 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, len;
@@ -151,7 +159,7 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
@@ -203,7 +211,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +225,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +238,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +247,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_txpower/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211.h 2007-03-05 00:31:49.235296061 +0100
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_txpower/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_module.c 2007-03-05 00:31:52.435344332 +0100
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,10 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +63,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +83,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +91,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +102,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +116,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +141,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +152,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +170,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +178,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +194,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +213,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +246,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +271,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +285,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_txpower/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_rx.c 2007-03-05 00:31:52.485345087 +0100
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,83 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +128,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +158,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +197,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +210,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +220,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +242,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,8 +251,8 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
@@ -253,7 +317,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +358,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +368,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +403,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +413,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +431,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -444,7 +508,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -483,7 +547,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +565,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +593,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +619,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -575,7 +639,7 @@
#endif
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -606,7 +670,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +683,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +694,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +728,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +738,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +758,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +786,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +827,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +960,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +977,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1028,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1055,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1078,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1147,7 +1211,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,7 +1219,7 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
@@ -1172,7 +1236,7 @@
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1204,7 +1268,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1303,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1262,11 +1326,11 @@
spin_lock_irqsave(&ieee->lock, flags);
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1370,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1321,15 +1385,15 @@
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
@@ -1339,7 +1403,7 @@
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1347,7 +1411,7 @@
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1419,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_txpower/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_softmac.c 2007-03-05 00:31:52.525345690 +0100
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,7 +34,7 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
@@ -52,7 +52,7 @@
* Then it updates the pointer so that
* it points after the new MFIE tag added.
*/
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
u8 *tag = *tag_p;
@@ -69,7 +69,7 @@
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
u8 *tag = *tag_p;
@@ -92,7 +92,7 @@
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
@@ -110,7 +110,7 @@
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
@@ -125,15 +125,15 @@
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
@@ -144,13 +144,13 @@
spin_lock_irqsave(&ieee->lock, flags);
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
if(single){
if(ieee->queue_stop){
- enqueue_mgmt(ieee,skb);
+ enqueue_mgmt_rtl7(ieee,skb);
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -184,7 +184,7 @@
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
@@ -219,7 +219,7 @@
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
@@ -228,7 +228,7 @@
len = ieee->current_network.ssid_len;
- rate_len = ieee80211_MFIE_rate_len(ieee);
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
@@ -251,21 +251,21 @@
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
unsigned long flags;
- skb = ieee80211_get_beacon_(ieee);
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
@@ -279,37 +279,37 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
- skb = ieee80211_probe_req(ieee);
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
* in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
@@ -349,7 +349,7 @@
ieee->set_chan(ieee->dev, ch);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
@@ -384,11 +384,17 @@
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
+ down(&ieee->scan_sem);
do{
ieee->current_network.channel =
@@ -402,7 +408,7 @@
goto out;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,25 +459,25 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
// unsigned long flags;
@@ -490,22 +496,22 @@
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
@@ -513,18 +519,18 @@
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
struct sk_buff *skb;
@@ -557,7 +563,7 @@
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -578,7 +584,7 @@
else
atim_len = 0;
- if(ieee80211_is_54g(ieee->current_network))
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
@@ -664,7 +670,7 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
@@ -673,7 +679,7 @@
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
skb = dev_alloc_skb(len);
@@ -711,13 +717,13 @@
tag = (u8*) skb_put(skb, rate_len);
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
@@ -744,7 +750,7 @@
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
@@ -770,35 +776,35 @@
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
@@ -807,7 +813,7 @@
unsigned int wpa_len = beacon->wpa_ie_len;
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
@@ -848,8 +854,8 @@
tag = skb_put(skb, rate_len);
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
tag = skb_put(skb,wpa_len);
@@ -858,7 +864,7 @@
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -887,13 +893,13 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
@@ -901,20 +907,20 @@
IEEE80211_DEBUG_MGMT("Stopping scan\n");
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
u8 *c;
struct sk_buff *skb;
@@ -924,9 +930,9 @@
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
@@ -935,16 +941,16 @@
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
@@ -954,20 +960,26 @@
IEEE80211_DEBUG_MGMT("Sending association request\n");
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
@@ -977,13 +989,13 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
@@ -995,24 +1007,29 @@
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
- ieee80211_stop_scan(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
+ ieee80211_associate_step1_rtl7(ieee);
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
@@ -1079,7 +1096,7 @@
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1095,14 +1112,13 @@
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct ieee80211_network *target;
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
/* if the state become different that NOLINK means
@@ -1112,7 +1128,7 @@
break;
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -1120,7 +1136,7 @@
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
@@ -1145,7 +1161,7 @@
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
@@ -1163,7 +1179,7 @@
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
@@ -1201,7 +1217,7 @@
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
@@ -1219,7 +1235,7 @@
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
@@ -1233,45 +1249,45 @@
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
//unsigned long flags;
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
@@ -1285,18 +1301,18 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
{
int timeout = ieee->ps_timeout;
u8 dtim;
@@ -1343,7 +1359,7 @@
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
@@ -1360,12 +1376,12 @@
#warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_wakeup(ieee, 1);
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
@@ -1386,7 +1402,7 @@
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee,1);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
ieee->ps_th = th;
ieee->ps_tl = tl;
@@ -1400,7 +1416,7 @@
#warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_wakeup(ieee,1);
+ ieee80211_sta_wakeup_rtl7(ieee,1);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
@@ -1410,13 +1426,13 @@
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
@@ -1429,11 +1445,11 @@
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
@@ -1454,7 +1470,7 @@
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,17 +1478,18 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
@@ -1496,19 +1513,19 @@
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
- ieee80211_associate_complete(ieee);
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
@@ -1519,7 +1536,7 @@
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_rx_assoc_rq(ieee, skb);
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
case IEEE80211_STYPE_AUTH:
@@ -1530,23 +1547,23 @@
IEEE80211_DEBUG_MGMT("Received authentication response");
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
- ieee80211_associate_step2(ieee);
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
@@ -1558,7 +1575,7 @@
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
- ieee80211_rx_probe_rq(ieee, skb);
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
case IEEE80211_STYPE_DISASSOC:
@@ -1573,8 +1590,8 @@
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
@@ -1610,7 +1627,7 @@
* to the driver later, when it wakes the queue.
*/
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
@@ -1643,7 +1660,7 @@
#endif
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
@@ -1662,7 +1679,7 @@
}
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
@@ -1670,7 +1687,7 @@
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
@@ -1690,19 +1707,19 @@
}
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,7 +1727,7 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -1723,7 +1740,7 @@
ieee->queue_stop = 0;
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
header = (struct ieee80211_hdr_3addr *) skb->data;
@@ -1738,7 +1755,7 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
+ ieee80211_resume_tx_rtl7(ieee);
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
@@ -1750,7 +1767,7 @@
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1765,7 +1782,7 @@
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
@@ -1778,7 +1795,7 @@
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
@@ -1796,7 +1813,7 @@
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
@@ -1804,7 +1821,7 @@
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
@@ -1814,8 +1831,15 @@
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
@@ -1834,7 +1858,7 @@
}
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
@@ -1851,13 +1875,13 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
+ ieee80211_randomize_cell_rtl7(ieee);
if(ieee->modulation & IEEE80211_CCK_MODULATION){
@@ -1901,9 +1925,9 @@
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
- ieee80211_start_send_beacons(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
@@ -1913,13 +1937,13 @@
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,7 +1951,7 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
@@ -1937,34 +1961,42 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
+ ieee80211_start_scan_rtl7(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
+ ieee80211_reset_queue_rtl7(ieee);
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
@@ -1986,12 +2018,12 @@
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
spin_lock_irqsave(&ieee->lock, flags);
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
+ ieee80211_start_scan_rtl7(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -1999,14 +2031,14 @@
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
struct sk_buff *skb;
struct ieee80211_probe_response *b;
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
if (!skb)
return NULL;
@@ -2018,12 +2050,12 @@
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
- skb = ieee80211_get_beacon_(ieee);
+ skb = ieee80211_get_beacon__rtl7(ieee);
if(!skb)
return NULL;
@@ -2038,44 +2070,44 @@
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
ieee->proto_started = 0;
- ieee80211_stop_send_beacons(ieee);
+ ieee80211_stop_send_beacons_rtl7(ieee);
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
- ieee80211_stop_scan(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
@@ -2094,9 +2126,7 @@
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2109,21 +2139,18 @@
*/
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
@@ -2143,7 +2170,7 @@
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
@@ -2153,25 +2180,34 @@
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
@@ -2179,12 +2215,12 @@
spin_lock_init(&ieee->beacon_lock);
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
@@ -2201,7 +2237,7 @@
********************************************************/
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2211,16 +2247,16 @@
}
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
int ret = 0;
@@ -2231,7 +2267,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2279,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,14 +2303,14 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
struct ieee80211_security sec = {
@@ -2300,13 +2336,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2387,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,7 +2404,7 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
@@ -2407,7 +2443,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2457,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2478,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2561,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2552,20 +2588,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2585,7 +2621,7 @@
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2633,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c 2007-03-05 00:31:52.575346444 +0100
@@ -18,7 +18,7 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
+const long ieee80211_wlan_frequencies_rtl7[] = {
2412, 2417, 2422, 2427,
2432, 2437, 2442, 2447,
2452, 2457, 2462, 2467,
@@ -26,7 +26,7 @@
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
@@ -46,7 +46,7 @@
int f = fwrq->m / 100000;
int c = 0;
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
/* hack to fall through */
@@ -68,8 +68,8 @@
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -95,7 +95,7 @@
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -124,7 +124,7 @@
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
@@ -134,14 +134,14 @@
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
@@ -154,7 +154,7 @@
}
if (ifup)
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
/* just to avoid to give inconsistent infos in the
* get wx method. not really needed otherwise
@@ -167,14 +167,14 @@
spin_unlock_irqrestore(&ieee->lock, flags);
if (ifup)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
return ret;
}
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
@@ -209,7 +209,7 @@
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -223,7 +223,7 @@
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -233,7 +233,7 @@
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -245,8 +245,7 @@
goto out;
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
@@ -254,9 +253,9 @@
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
}
out:
@@ -264,8 +263,14 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
short chan;
chan = ieee->current_network.channel;
@@ -275,12 +280,12 @@
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
- ieee80211_stop_send_beacons(ieee);
+ ieee80211_stop_send_beacons_rtl7(ieee);
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
ieee->set_chan(ieee->dev, chan);
@@ -291,7 +296,7 @@
ieee->data_hard_resume(ieee->dev);
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
netif_carrier_on(ieee->dev);
@@ -299,7 +304,7 @@
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
@@ -322,7 +327,7 @@
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
@@ -348,7 +353,7 @@
}
if(proto_started)
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
@@ -356,7 +361,11 @@
spin_lock_irqsave(&ieee->lock, flags);
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
+#endif
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
@@ -371,13 +380,13 @@
spin_unlock_irqrestore(&ieee->lock, flags);
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,7 +394,7 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -422,7 +431,7 @@
return 0;
}
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -446,7 +455,7 @@
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -509,7 +518,7 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -547,19 +556,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_txpower/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_tx.c 2007-03-05 00:31:52.575346444 +0100
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,10 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +158,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +181,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +228,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +238,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +270,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -397,7 +400,7 @@
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -432,7 +435,7 @@
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
@@ -446,7 +449,7 @@
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
@@ -458,13 +461,14 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -481,14 +485,14 @@
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
@@ -504,4 +508,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_txpower/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_txpower/ieee80211/ieee80211_wx.c 2007-03-05 00:31:52.635347349 +0100
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -281,7 +282,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +292,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +315,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +327,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -418,7 +419,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -470,6 +471,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7); |
Patch | aircrack-ng/patches/old/rtl8187_2.6.20v3.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_txpower/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/ieee80211.h 2007-04-23 00:08:15.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_txpower/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8180_93cx6.c 2007-04-23 00:08:11.000000000 +0200
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_txpower/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8180_hw.h 2007-04-23 00:08:15.000000000 +0200
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_txpower/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8180_rtl8225.c 2007-04-23 00:08:11.000000000 +0200
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_txpower/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8180_rtl8225.h 2007-04-23 00:08:15.000000000 +0200
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_txpower/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8180_rtl8225z2.c 2007-04-23 00:08:11.000000000 +0200
@@ -129,7 +129,7 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 mode = priv->ieee80211->mode;
@@ -153,7 +153,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -280,7 +280,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -396,7 +396,7 @@
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int GainIdx;
// int GainSetting;
@@ -418,7 +418,10 @@
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
cck_power_level += priv->cck_txpwr_base;
@@ -489,9 +492,9 @@
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225z2_SetTXPowerLevel(dev, ch);
@@ -509,7 +512,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -581,7 +584,7 @@
#endif
void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
@@ -958,7 +961,7 @@
void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(priv->ieee80211->mode == IEEE_A)
{
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_txpower/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8180_wx.c 2007-04-23 00:08:11.000000000 +0200
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,147 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ down(&priv->wx_sem);
+ wrqu->power.value = priv->chtxpwr_ofdm[1] + MIN_TX_POWER;
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
+ up(&priv->wx_sem);
+
+ return 0;
+}
+
+#if 0
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ int ret = 0, i = 0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > MAX_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < MIN_TX_POWER)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<=14;i++)
+ {
+ priv->chtxpwr[i] = wrqu->power.value + 1 - MIN_TX_POWER;
+ priv->chtxpwr_ofdm[i] = wrqu->power.value - MIN_TX_POWER;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
up(&priv->wx_sem);
-
+
return ret;
-
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +226,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +259,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +283,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +307,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +326,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +378,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +409,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +417,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +437,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +487,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +525,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +543,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +573,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +611,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -624,31 +664,27 @@
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
+
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
- },
- {
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+
}
};
@@ -660,13 +696,12 @@
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +714,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_txpower/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8187_core.c 2007-04-23 00:08:11.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+#define DEBUG_EPROM
+#define DEBUG_REGISTERS
+#define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,21 +414,22 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -430,7 +443,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +460,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +472,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +481,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +500,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +536,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +552,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +574,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +596,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +615,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +629,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +651,115 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +767,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +811,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +836,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +874,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +901,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +918,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +943,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +955,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +968,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +984,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +994,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1010,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1034,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1066,32 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
}
-
+
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1107,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1120,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1134,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1155,32 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_lock_irqsave(&priv->tx_lock,flags);
+
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+ }
+ else
+ {
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1190,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1205,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1220,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1229,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,30 +1237,30 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
@@ -1228,7 +1270,7 @@
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1249,55 +1291,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1349,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1360,16 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1381,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,8 +1394,8 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
@@ -1365,32 +1407,32 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
+
// if(priv->shortpre)
// tx[0] |= (1<<16);
-
+
//if(len > priv->rts_threshold){
// tx[0] |= (1<<23); //ENABLE RTS
// tx[0] |= (1<<18); //ENABLE CTS
@@ -1399,18 +1441,18 @@
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
+
// duration = rtl8180_len2duration(len,
-// rate,&ext);
+// rate,&ext);
// tx[1] |= (duration & 0x7fff) <<16;
// if(ext) tx[1] |= (1<<31);
-
+
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1463,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1480,54 @@
}
}
-
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1536,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1547,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1568,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1595,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1622,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,9 +1663,9 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
@@ -1622,23 +1673,27 @@
priv->ieee80211->mode = IEEE_G;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1710,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1770,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1818,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1827,64 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1901,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +1936,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +1965,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +1985,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2009,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2055,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2121,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2144,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2158,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2202,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2341,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2359,17 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+
down(&priv->wx_sem);
-
+
struct iwreq *wrq = (struct iwreq *)rq;
-
+
int ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2378,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2321,9 +2390,9 @@
int status,len,flen;
struct sk_buff *skb;
u32 *desc;
-
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2335,17 +2404,17 @@
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
+
stats.signal = (desc[1] & 0x7f00)>>8;
stats.noise = desc[1] &0xff;
stats.rate = desc[0] >> 20 & 0xf;
@@ -2353,22 +2422,23 @@
stats.mac_time[1] = desc[3];
skb = dev_alloc_skb(flen-4);
//skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
- if(!ieee80211_rx(priv->ieee80211,
+
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2446,9 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
+
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2466,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2488,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2536,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2553,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2570,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2583,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2598,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_txpower/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/beta-8187/r8187.h 2007-04-23 00:08:15.000000000 +0200
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -148,7 +153,7 @@
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
+ short prism_hdr;
// struct timer_list scan_timer;
/*short scanpending;
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_txpower/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt.c 2007-04-23 00:09:00.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_ccmp.c 2007-04-23 00:09:00.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -59,7 +69,7 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -75,7 +85,7 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -105,7 +115,7 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
@@ -114,7 +124,7 @@
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +132,7 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +196,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +247,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +255,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +272,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +336,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +347,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,7 +375,7 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
@@ -396,7 +406,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +430,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +447,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_txpower/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt.h 2007-04-23 00:09:03.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_tkip.c 2007-04-23 00:09:00.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -62,7 +72,7 @@
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -101,7 +111,7 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
if (_priv && _priv->tfm_michael)
@@ -200,7 +210,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +232,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +278,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -283,11 +293,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -325,7 +335,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -382,10 +392,10 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
@@ -428,10 +438,14 @@
}
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+ struct hash_desc desc;
+#endif
struct scatterlist sg[2];
+ int ret=0;
if (tkey->tfm_michael == NULL) {
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
@@ -445,15 +459,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
+#else
+ if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
+ return -1;
- return 0;
+ desc.tfm = tkey->tfm_michael;
+ desc.flags = 0;
+ ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
+
+ return ret;
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +506,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,9 +518,9 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
@@ -506,7 +529,7 @@
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +550,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +566,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +574,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,8 +583,8 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
@@ -572,7 +595,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,7 +611,7 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
@@ -618,7 +641,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +671,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +698,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_crypt_wep.c 2007-04-23 00:09:00.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -40,7 +50,7 @@
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -72,7 +82,7 @@
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
if (_priv && _priv->tfm)
@@ -87,7 +97,7 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, len;
@@ -151,7 +161,7 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
@@ -203,7 +213,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +227,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +240,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +249,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_txpower/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211.h 2007-04-23 00:09:03.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_txpower/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_module.c 2007-04-23 00:09:00.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_txpower/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_rx.c 2007-04-23 00:09:00.000000000 +0200
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +130,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +160,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +199,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +212,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +222,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +244,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,8 +253,8 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
@@ -253,7 +319,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +360,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +370,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +405,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +415,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +433,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -444,7 +510,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -483,7 +549,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +567,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +595,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +621,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -575,7 +641,7 @@
#endif
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -606,7 +672,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +685,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +696,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +730,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +740,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +760,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +788,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +829,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +962,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +979,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1030,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1057,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1080,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1147,7 +1213,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,7 +1221,7 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
@@ -1172,7 +1238,7 @@
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1204,7 +1270,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1305,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1262,11 +1328,11 @@
spin_lock_irqsave(&ieee->lock, flags);
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1372,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1321,15 +1387,15 @@
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
@@ -1339,7 +1405,7 @@
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1347,7 +1413,7 @@
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1421,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_txpower/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_softmac.c 2007-04-23 00:09:00.000000000 +0200
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,7 +34,7 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
@@ -52,7 +52,7 @@
* Then it updates the pointer so that
* it points after the new MFIE tag added.
*/
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
u8 *tag = *tag_p;
@@ -69,7 +69,7 @@
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
u8 *tag = *tag_p;
@@ -92,7 +92,7 @@
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
@@ -110,7 +110,7 @@
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
@@ -125,15 +125,15 @@
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
@@ -144,13 +144,13 @@
spin_lock_irqsave(&ieee->lock, flags);
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
if(single){
if(ieee->queue_stop){
- enqueue_mgmt(ieee,skb);
+ enqueue_mgmt_rtl7(ieee,skb);
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -184,7 +184,7 @@
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
@@ -219,7 +219,7 @@
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
@@ -228,7 +228,7 @@
len = ieee->current_network.ssid_len;
- rate_len = ieee80211_MFIE_rate_len(ieee);
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
@@ -251,21 +251,21 @@
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
unsigned long flags;
- skb = ieee80211_get_beacon_(ieee);
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
@@ -279,37 +279,37 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
- skb = ieee80211_probe_req(ieee);
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
* in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
@@ -349,7 +349,7 @@
ieee->set_chan(ieee->dev, ch);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
@@ -384,11 +384,17 @@
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
+ down(&ieee->scan_sem);
do{
ieee->current_network.channel =
@@ -402,7 +408,7 @@
goto out;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,25 +459,25 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
// unsigned long flags;
@@ -490,22 +496,22 @@
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
@@ -513,18 +519,18 @@
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
struct sk_buff *skb;
@@ -557,7 +563,7 @@
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -578,7 +584,7 @@
else
atim_len = 0;
- if(ieee80211_is_54g(ieee->current_network))
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
@@ -664,7 +670,7 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
@@ -673,7 +679,7 @@
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
skb = dev_alloc_skb(len);
@@ -711,13 +717,13 @@
tag = (u8*) skb_put(skb, rate_len);
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
@@ -744,7 +750,7 @@
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
@@ -770,35 +776,35 @@
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
@@ -807,7 +813,7 @@
unsigned int wpa_len = beacon->wpa_ie_len;
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
@@ -848,8 +854,8 @@
tag = skb_put(skb, rate_len);
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
tag = skb_put(skb,wpa_len);
@@ -858,7 +864,7 @@
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -887,13 +893,13 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
@@ -901,20 +907,20 @@
IEEE80211_DEBUG_MGMT("Stopping scan\n");
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
u8 *c;
struct sk_buff *skb;
@@ -924,9 +930,9 @@
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
@@ -935,16 +941,16 @@
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
@@ -954,20 +960,26 @@
IEEE80211_DEBUG_MGMT("Sending association request\n");
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
if (!skb)
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
}
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
@@ -977,13 +989,13 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
@@ -995,24 +1007,29 @@
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
- ieee80211_stop_scan(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
+ ieee80211_associate_step1_rtl7(ieee);
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
@@ -1079,7 +1096,7 @@
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1092,17 +1109,15 @@
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct ieee80211_network *target;
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
/* if the state become different that NOLINK means
@@ -1112,7 +1127,7 @@
break;
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -1120,7 +1135,7 @@
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
@@ -1145,7 +1160,7 @@
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
@@ -1163,7 +1178,7 @@
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
@@ -1201,7 +1216,7 @@
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
@@ -1219,7 +1234,7 @@
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
@@ -1233,45 +1248,45 @@
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
//unsigned long flags;
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
@@ -1285,18 +1300,18 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
{
int timeout = ieee->ps_timeout;
u8 dtim;
@@ -1343,7 +1358,7 @@
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
@@ -1360,12 +1375,12 @@
#warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_wakeup(ieee, 1);
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
@@ -1386,7 +1401,7 @@
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee,1);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
ieee->ps_th = th;
ieee->ps_tl = tl;
@@ -1400,7 +1415,7 @@
#warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_wakeup(ieee,1);
+ ieee80211_sta_wakeup_rtl7(ieee,1);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
@@ -1410,13 +1425,13 @@
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
@@ -1429,11 +1444,11 @@
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
@@ -1454,7 +1469,7 @@
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,17 +1477,18 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
@@ -1496,19 +1512,19 @@
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
- ieee80211_associate_complete(ieee);
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
@@ -1519,7 +1535,7 @@
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_rx_assoc_rq(ieee, skb);
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
case IEEE80211_STYPE_AUTH:
@@ -1530,23 +1546,23 @@
IEEE80211_DEBUG_MGMT("Received authentication response");
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
- ieee80211_associate_step2(ieee);
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
@@ -1558,7 +1574,7 @@
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
- ieee80211_rx_probe_rq(ieee, skb);
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
case IEEE80211_STYPE_DISASSOC:
@@ -1573,8 +1589,8 @@
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
@@ -1610,7 +1626,7 @@
* to the driver later, when it wakes the queue.
*/
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
@@ -1643,7 +1659,7 @@
#endif
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
@@ -1662,7 +1678,7 @@
}
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
@@ -1670,7 +1686,7 @@
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
@@ -1690,19 +1706,19 @@
}
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,7 +1726,7 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -1723,7 +1739,7 @@
ieee->queue_stop = 0;
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
header = (struct ieee80211_hdr_3addr *) skb->data;
@@ -1738,7 +1754,7 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
+ ieee80211_resume_tx_rtl7(ieee);
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
@@ -1750,7 +1766,7 @@
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1765,7 +1781,7 @@
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
@@ -1778,7 +1794,7 @@
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
@@ -1796,7 +1812,7 @@
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
@@ -1804,7 +1820,7 @@
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
@@ -1814,8 +1830,15 @@
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
@@ -1834,7 +1857,7 @@
}
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
@@ -1851,13 +1874,13 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
+ ieee80211_randomize_cell_rtl7(ieee);
if(ieee->modulation & IEEE80211_CCK_MODULATION){
@@ -1901,9 +1924,9 @@
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
- ieee80211_start_send_beacons(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
@@ -1913,13 +1936,13 @@
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,7 +1950,7 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
@@ -1937,34 +1960,42 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
+ ieee80211_start_scan_rtl7(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
+ ieee80211_reset_queue_rtl7(ieee);
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
unsigned long flags;
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
@@ -1986,12 +2017,12 @@
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
spin_lock_irqsave(&ieee->lock, flags);
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
+ ieee80211_start_scan_rtl7(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -1999,14 +2030,14 @@
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
struct sk_buff *skb;
struct ieee80211_probe_response *b;
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
if (!skb)
return NULL;
@@ -2018,12 +2049,12 @@
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
- skb = ieee80211_get_beacon_(ieee);
+ skb = ieee80211_get_beacon__rtl7(ieee);
if(!skb)
return NULL;
@@ -2038,44 +2069,44 @@
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
ieee->proto_started = 0;
- ieee80211_stop_send_beacons(ieee);
+ ieee80211_stop_send_beacons_rtl7(ieee);
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
- ieee80211_stop_scan(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
@@ -2094,9 +2125,7 @@
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2109,21 +2138,18 @@
*/
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
@@ -2143,7 +2169,7 @@
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
@@ -2153,25 +2179,34 @@
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
@@ -2179,12 +2214,12 @@
spin_lock_init(&ieee->beacon_lock);
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
@@ -2201,7 +2236,7 @@
********************************************************/
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2211,16 +2246,16 @@
}
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
int ret = 0;
@@ -2231,7 +2266,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2278,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,14 +2302,14 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
struct ieee80211_security sec = {
@@ -2300,13 +2335,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2386,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,7 +2403,7 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
@@ -2407,7 +2442,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2456,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2477,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2560,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2552,20 +2587,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2585,7 +2620,7 @@
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2632,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_softmac_wx.c 2007-04-23 00:09:00.000000000 +0200
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_txpower/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_tx.c 2007-04-23 00:09:00.000000000 +0200
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -397,7 +402,7 @@
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -432,7 +437,7 @@
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
@@ -446,7 +451,7 @@
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
@@ -458,13 +463,14 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -481,14 +487,14 @@
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_txpower/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_txpower/ieee80211/ieee80211_wx.c 2007-04-23 00:09:00.000000000 +0200
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -281,7 +282,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +292,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +315,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +327,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -418,7 +419,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -470,6 +471,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7); |
Patch | aircrack-ng/patches/old/rtl8187_2.6.20v4.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_rawtx/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211.h 2007-05-26 10:37:51.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/beta-8187/Makefile rtl8187_rawtx/beta-8187/Makefile
--- rtl8187_orig/beta-8187/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/Makefile 2007-05-27 10:47:14.000000000 +0200
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_93cx6.c 2007-05-26 10:37:46.000000000 +0200
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_rawtx/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_hw.h 2007-05-26 10:37:51.000000000 +0200
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.c 2007-05-26 10:37:46.000000000 +0200
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.h 2007-05-26 10:37:51.000000000 +0200
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c 2007-05-26 10:37:46.000000000 +0200
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 0
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,47 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
+
+
max_cck_power_level = 15;
//min_cck_power_level = 0;
max_ofdm_power_level = 25; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+
for(i=0;i<8;i++){
-
+
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +481,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +510,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +556,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +625,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +680,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +710,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +740,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +771,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +798,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +823,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +851,47 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +902,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +915,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x9d); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +980,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1007,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1024,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_rawtx/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_wx.c 2007-05-26 10:37:46.000000000 +0200
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,157 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +236,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +269,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +293,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +317,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +336,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +388,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +419,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +427,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +447,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +497,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +535,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +553,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +583,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +621,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,32 +673,28 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
+
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
- },
- {
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+
}
};
@@ -660,13 +706,12 @@
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +724,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_rawtx/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187_core.c 2007-05-27 11:31:45.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,21 +414,22 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -430,7 +443,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +460,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +472,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +481,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +500,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +536,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +552,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +574,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +596,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +615,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +629,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +651,115 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +767,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +811,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +836,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +874,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +901,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +918,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +943,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +955,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +968,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +984,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +994,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1010,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1034,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1066,38 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1113,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1126,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1140,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1161,24 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
+ spin_lock_irqsave(&priv->tx_lock,flags);
+
//DMESG("TX");
if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
ieeerate2rtlrate(rate));
priv->stats.txdatapkt++;
-
+
if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1188,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1203,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1218,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1227,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,30 +1235,30 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
@@ -1228,7 +1268,7 @@
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1249,55 +1289,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1347,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1358,16 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1379,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,8 +1392,8 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
@@ -1365,32 +1405,32 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
+
// if(priv->shortpre)
// tx[0] |= (1<<16);
-
+
//if(len > priv->rts_threshold){
// tx[0] |= (1<<23); //ENABLE RTS
// tx[0] |= (1<<18); //ENABLE CTS
@@ -1399,18 +1439,18 @@
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
+
// duration = rtl8180_len2duration(len,
-// rate,&ext);
+// rate,&ext);
// tx[1] |= (duration & 0x7fff) <<16;
// if(ext) tx[1] |= (1<<31);
-
+
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1461,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1478,54 @@
}
}
-
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1534,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1545,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1566,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1593,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1620,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1661,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1708,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1768,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1816,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1825,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1908,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +1943,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +1972,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +1992,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2016,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2062,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2128,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2151,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2165,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2209,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2348,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2366,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2386,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2397,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2410,111 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2522,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2541,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2563,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2611,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2628,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2645,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2658,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2673,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_rawtx/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187.h 2007-05-26 10:37:51.000000000 +0200
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,16 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +166,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +179,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +233,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,18 +247,18 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.c 2007-05-26 10:38:07.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-05-26 10:38:07.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -59,7 +69,7 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -75,7 +85,7 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -105,7 +115,7 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
@@ -114,7 +124,7 @@
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +132,7 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +196,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +247,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +255,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +272,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +336,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +347,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,7 +375,7 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
@@ -396,7 +406,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +430,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +447,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.h 2007-05-26 10:38:11.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-05-26 10:38:07.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -62,7 +72,7 @@
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -101,7 +111,7 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
if (_priv && _priv->tfm_michael)
@@ -200,7 +210,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +232,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +278,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -283,11 +293,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -325,7 +335,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -382,10 +392,10 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
@@ -428,10 +438,14 @@
}
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+ struct hash_desc desc;
+#endif
struct scatterlist sg[2];
+ int ret=0;
if (tkey->tfm_michael == NULL) {
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
@@ -445,15 +459,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
+#else
+ if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
+ return -1;
- return 0;
+ desc.tfm = tkey->tfm_michael;
+ desc.flags = 0;
+ ret = crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
+
+ return ret;
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +506,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,9 +518,9 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
@@ -506,7 +529,7 @@
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +550,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +566,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +574,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,8 +583,8 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
@@ -572,7 +595,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,7 +611,7 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
@@ -618,7 +641,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +671,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +698,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-05-26 10:38:07.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -40,7 +50,7 @@
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -72,7 +82,7 @@
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
if (_priv && _priv->tfm)
@@ -87,7 +97,7 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, len;
@@ -151,7 +161,7 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
@@ -203,7 +213,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +227,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +240,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +249,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_rawtx/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211.h 2007-05-26 10:38:11.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_module.c 2007-05-26 10:38:07.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_rx.c 2007-05-26 10:38:07.000000000 +0200
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +130,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +160,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +199,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +212,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +222,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +244,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,8 +253,8 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
@@ -253,7 +319,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +360,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +370,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +405,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +415,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +433,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -444,7 +510,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -483,7 +549,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +567,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +595,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +621,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -575,7 +641,7 @@
#endif
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -606,7 +672,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +685,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +696,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +730,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +740,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +760,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +788,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +829,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +962,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +979,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1030,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1057,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1080,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1147,7 +1213,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,7 +1221,7 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
@@ -1172,7 +1238,7 @@
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1204,7 +1270,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1305,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1262,11 +1328,11 @@
spin_lock_irqsave(&ieee->lock, flags);
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1372,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1321,15 +1387,15 @@
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
@@ -1339,7 +1405,7 @@
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1347,7 +1413,7 @@
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1421,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac.c 2007-05-26 10:38:07.000000000 +0200
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,208 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,103 +879,109 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
@@ -977,62 +989,67 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1060,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1085,18 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1089,42 +1106,40 @@
}
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1147,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1207,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1300,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1327,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1466,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1477,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1620,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1645,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1659,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1676,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1706,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1728,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1756,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1779,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
{
-
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1876,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1907,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1952,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1962,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2014,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
- ieee80211_disassociate(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
+
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2138,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2170,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2247,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2268,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2280,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2304,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2337,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2388,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2405,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2444,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2458,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2479,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2562,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2574,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2589,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2618,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2634,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-05-26 10:38:07.000000000 +0200
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_tx.c 2007-05-26 10:38:07.000000000 +0200
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -397,7 +402,7 @@
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -432,7 +437,7 @@
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
@@ -446,7 +451,7 @@
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
@@ -458,13 +463,14 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -481,14 +487,14 @@
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_wx.c 2007-05-26 10:38:07.000000000 +0200
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -281,7 +282,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +292,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +315,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +327,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -418,7 +419,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -470,6 +471,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_orig/ieee80211/Makefile rtl8187_rawtx/ieee80211/Makefile
--- rtl8187_orig/ieee80211/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Makefile 2007-05-27 10:47:26.000000000 +0200
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_orig/Makefile rtl8187_rawtx/Makefile
--- rtl8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/Makefile 2007-05-26 10:39:10.000000000 +0200
@@ -0,0 +1,36 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_orig/symvers rtl8187_rawtx/symvers
--- rtl8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/symvers 2007-05-26 10:39:22.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd .. |
Patch | aircrack-ng/patches/old/rtl8187_2.6.21.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_rawtx/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211.h 2007-06-05 14:00:05.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/beta-8187/Makefile rtl8187_rawtx/beta-8187/Makefile
--- rtl8187_orig/beta-8187/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/Makefile 2007-05-27 10:47:14.000000000 +0200
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_93cx6.c 2007-06-05 14:00:01.000000000 +0200
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_rawtx/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_hw.h 2007-06-05 14:00:05.000000000 +0200
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.c 2007-06-05 14:00:01.000000000 +0200
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.h 2007-06-05 14:00:05.000000000 +0200
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c 2007-06-05 14:00:01.000000000 +0200
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 0
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,47 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
+
+
max_cck_power_level = 15;
//min_cck_power_level = 0;
max_ofdm_power_level = 25; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+
for(i=0;i<8;i++){
-
+
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +481,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +510,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +556,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +625,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +680,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +710,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +740,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +771,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +798,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +823,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +851,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +901,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +914,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x9d); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +979,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1006,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1023,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_rawtx/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_wx.c 2007-06-05 14:00:01.000000000 +0200
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,157 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +236,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +269,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +293,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +317,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +336,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +388,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +419,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +427,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +447,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +497,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +535,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +553,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +583,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +621,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,32 +673,28 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
+
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
- },
- {
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+
}
};
@@ -660,13 +706,12 @@
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +724,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_rawtx/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187_core.c 2007-06-05 14:00:01.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,21 +414,22 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -430,7 +443,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +460,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +472,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +481,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +500,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +536,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +552,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +574,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +596,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +615,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +629,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +651,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +771,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +815,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +840,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +878,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +905,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +922,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +947,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +959,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +972,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +988,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +998,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1014,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1038,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1070,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1121,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1134,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1148,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1169,30 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
+ spin_lock_irqsave(&priv->tx_lock,flags);
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
ieeerate2rtlrate(rate));
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1202,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1217,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1232,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1241,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1249,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1249,55 +1307,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1365,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,31 +1376,38 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
priv->stats.txnperr++;
kfree(tx_urb->transfer_buffer);
usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_np_pending);
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ atomic_dec(&priv->tx_np_pending);
+ }
//rtl8180_try_wake_queue(dev,NORM_PRIORITY);
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,45 +1417,47 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
- if( pend > MAX_TX_URB){
- if(priority == NORM_PRIORITY)
- priv->stats.txnpdrop++;
- else
- priv->stats.txlpdrop++;
- return -1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ if( pend > MAX_TX_URB){
+ if(priority == NORM_PRIORITY)
+ priv->stats.txnpdrop++;
+ else
+ priv->stats.txlpdrop++;
+ return -1;
+ }
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
+
// if(priv->shortpre)
// tx[0] |= (1<<16);
-
+
//if(len > priv->rts_threshold){
// tx[0] |= (1<<23); //ENABLE RTS
// tx[0] |= (1<<18); //ENABLE CTS
@@ -1399,18 +1466,18 @@
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
+
// duration = rtl8180_len2duration(len,
-// rate,&ext);
+// rate,&ext);
// tx[1] |= (duration & 0x7fff) <<16;
// if(ext) tx[1] |= (1<<31);
-
+
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,71 +1488,77 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev);
status = usb_submit_urb(tx_urb, GFP_ATOMIC);
if (!status){
- atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ }
return 0;
}else{
- DMESGE("Error TX URB %d, error %d",
- atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
- status);
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ DMESGE("Error TX URB %d, error %d",
+ atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
+ status);
+ }
return -1;
}
}
-
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1567,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1578,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1599,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1626,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1653,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1694,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1741,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1801,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1849,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1858,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1941,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +1976,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2005,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2025,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2049,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2095,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2161,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2184,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2198,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2242,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2381,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2399,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2419,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2430,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2443,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2553,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2572,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2594,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2642,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2659,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2676,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2689,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2704,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_rawtx/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187.h 2007-06-05 14:00:05.000000000 +0200
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,16 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +166,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +179,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +233,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,18 +247,18 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.c 2007-06-05 14:00:28.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-06-05 14:00:28.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.h 2007-06-05 14:00:34.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-06-05 14:00:28.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,19 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +412,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +424,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +472,26 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,13 +525,22 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
@@ -445,15 +552,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +599,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +611,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +649,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +665,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +673,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +682,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +700,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +716,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +761,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +791,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +818,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-06-05 14:00:28.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,21 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +210,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +240,22 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +276,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +290,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +303,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +312,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_rawtx/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211.h 2007-06-05 14:00:34.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_module.c 2007-06-05 14:00:28.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_rx.c 2007-06-05 14:00:28.000000000 +0200
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +130,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +160,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +199,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +212,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +222,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +244,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,8 +253,8 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
@@ -253,7 +319,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +360,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +370,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +405,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +415,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +433,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -444,7 +510,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -483,7 +549,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +567,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +595,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +621,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -575,7 +641,7 @@
#endif
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -606,7 +672,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +685,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +696,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +730,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +740,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +760,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +788,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +829,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +962,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +979,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1030,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1057,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1080,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1147,7 +1213,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,7 +1221,7 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
@@ -1172,7 +1238,7 @@
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1204,7 +1270,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1305,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1262,11 +1328,11 @@
spin_lock_irqsave(&ieee->lock, flags);
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1372,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1321,15 +1387,15 @@
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
@@ -1339,7 +1405,7 @@
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1347,7 +1413,7 @@
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1421,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac.c 2007-06-05 14:00:29.000000000 +0200
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,208 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,103 +879,109 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
@@ -977,62 +989,67 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1060,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1085,18 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1089,42 +1106,40 @@
}
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1147,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1207,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1300,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1327,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1466,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1477,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1620,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1645,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1659,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1676,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1706,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1728,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1756,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1779,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
{
-
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1876,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1907,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1952,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1962,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2014,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
- ieee80211_disassociate(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
+
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2138,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2170,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2247,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2268,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2280,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2304,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2337,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2388,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2405,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2444,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2458,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2479,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2562,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2574,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2589,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2618,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2634,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-06-05 14:00:29.000000000 +0200
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_tx.c 2007-06-05 14:00:29.000000000 +0200
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -397,7 +402,7 @@
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -432,7 +437,7 @@
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
@@ -446,7 +451,7 @@
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
@@ -458,13 +463,14 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -481,14 +487,14 @@
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_wx.c 2007-06-05 14:00:29.000000000 +0200
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -281,7 +282,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +292,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +315,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +327,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -418,7 +419,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -470,6 +471,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_orig/ieee80211/Makefile rtl8187_rawtx/ieee80211/Makefile
--- rtl8187_orig/ieee80211/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Makefile 2007-05-27 10:47:26.000000000 +0200
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_orig/Makefile rtl8187_rawtx/Makefile
--- rtl8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/Makefile 2007-05-26 10:39:10.000000000 +0200
@@ -0,0 +1,36 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_orig/symvers rtl8187_rawtx/symvers
--- rtl8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/symvers 2007-05-26 10:39:22.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd .. |
Patch | aircrack-ng/patches/old/rtl8187_2.6.21v2.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211_crypt.h rtl8187_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_orig/beta-8187/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211_crypt.h 2007-06-08 23:30:29.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_rawtx/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211.h 2007-06-08 23:30:29.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/beta-8187/Makefile rtl8187_rawtx/beta-8187/Makefile
--- rtl8187_orig/beta-8187/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/Makefile 2007-05-27 10:47:14.000000000 +0200
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_93cx6.c 2007-06-08 23:30:33.000000000 +0200
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_rawtx/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_hw.h 2007-06-08 23:30:29.000000000 +0200
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.c 2007-06-08 23:30:33.000000000 +0200
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.h 2007-06-08 23:30:29.000000000 +0200
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c 2007-06-08 23:30:33.000000000 +0200
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 0
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,47 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
+
+
max_cck_power_level = 15;
//min_cck_power_level = 0;
max_ofdm_power_level = 25; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+
for(i=0;i<8;i++){
-
+
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +481,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +510,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +556,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +625,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +680,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +710,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +740,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +771,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +798,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +823,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +851,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +901,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +914,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x9d); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +979,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1006,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1023,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_rawtx/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_wx.c 2007-06-08 23:30:33.000000000 +0200
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,157 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +236,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +269,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +293,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +317,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +336,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +388,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +419,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +427,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +447,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +497,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +535,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +553,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +583,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +621,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,32 +673,28 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
+
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
- },
- {
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+
}
};
@@ -660,13 +706,12 @@
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +724,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_rawtx/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187_core.c 2007-06-08 23:30:33.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,21 +414,22 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -430,7 +443,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +460,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +472,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +481,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +500,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +536,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +552,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +574,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +596,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +615,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +629,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +651,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +771,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +815,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +840,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +878,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +905,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +922,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +947,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +959,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +972,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +988,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +998,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1014,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1038,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1070,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1121,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1134,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1148,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1169,30 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
+ spin_lock_irqsave(&priv->tx_lock,flags);
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
ieeerate2rtlrate(rate));
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1202,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1217,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1232,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1241,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1249,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1249,55 +1307,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1365,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,31 +1376,38 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
priv->stats.txnperr++;
kfree(tx_urb->transfer_buffer);
usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_np_pending);
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ atomic_dec(&priv->tx_np_pending);
+ }
//rtl8180_try_wake_queue(dev,NORM_PRIORITY);
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,45 +1417,47 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
- if( pend > MAX_TX_URB){
- if(priority == NORM_PRIORITY)
- priv->stats.txnpdrop++;
- else
- priv->stats.txlpdrop++;
- return -1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ if( pend > MAX_TX_URB){
+ if(priority == NORM_PRIORITY)
+ priv->stats.txnpdrop++;
+ else
+ priv->stats.txlpdrop++;
+ return -1;
+ }
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
+
// if(priv->shortpre)
// tx[0] |= (1<<16);
-
+
//if(len > priv->rts_threshold){
// tx[0] |= (1<<23); //ENABLE RTS
// tx[0] |= (1<<18); //ENABLE CTS
@@ -1399,18 +1466,18 @@
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
+
// duration = rtl8180_len2duration(len,
-// rate,&ext);
+// rate,&ext);
// tx[1] |= (duration & 0x7fff) <<16;
// if(ext) tx[1] |= (1<<31);
-
+
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,71 +1488,77 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev);
status = usb_submit_urb(tx_urb, GFP_ATOMIC);
if (!status){
- atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ }
return 0;
}else{
- DMESGE("Error TX URB %d, error %d",
- atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
- status);
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ DMESGE("Error TX URB %d, error %d",
+ atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
+ status);
+ }
return -1;
}
}
-
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1567,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1578,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1599,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1626,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1653,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1694,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1741,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1801,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1849,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1858,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1941,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +1976,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2005,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2025,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2049,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2095,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2161,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2184,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2198,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2242,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2381,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2399,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2419,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2430,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2443,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2553,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2572,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2594,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2642,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2659,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2676,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2689,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2704,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_rawtx/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187.h 2007-06-08 23:30:29.000000000 +0200
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,16 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +166,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +179,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +233,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,18 +247,18 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.c 2007-06-08 23:30:47.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.h 2007-06-08 23:30:44.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,19 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +412,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +424,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +472,26 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,13 +525,22 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
@@ -445,15 +552,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +599,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +611,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +649,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +665,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +673,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +682,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +700,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +716,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +761,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +791,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +818,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,21 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +210,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +240,22 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +276,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +290,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +303,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +312,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_rawtx/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211.h 2007-06-08 23:30:44.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_module.c 2007-06-08 23:30:47.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_rx.c 2007-06-08 23:30:47.000000000 +0200
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +130,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +160,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +199,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +212,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +222,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +244,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,8 +253,8 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
@@ -253,7 +319,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +360,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +370,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +405,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +415,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +433,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -444,7 +510,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -483,7 +549,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +567,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +595,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +621,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -575,7 +641,7 @@
#endif
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -606,7 +672,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +685,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +696,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +730,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +740,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +760,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +788,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +829,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +962,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +979,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1030,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1057,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1080,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1147,7 +1213,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,7 +1221,7 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
@@ -1172,7 +1238,7 @@
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1204,7 +1270,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1305,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1262,11 +1328,11 @@
spin_lock_irqsave(&ieee->lock, flags);
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1372,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1321,15 +1387,15 @@
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
@@ -1339,7 +1405,7 @@
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1347,7 +1413,7 @@
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1421,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac.c 2007-06-08 23:30:47.000000000 +0200
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,208 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,103 +879,109 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
@@ -977,62 +989,67 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1060,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1085,18 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1089,42 +1106,40 @@
}
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1147,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1207,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1300,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1327,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1466,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1477,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1620,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1645,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1659,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1676,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1706,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1728,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1756,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1779,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
{
-
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1876,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1907,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1952,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1962,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2014,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
- ieee80211_disassociate(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
+
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2138,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2170,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2247,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2268,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2280,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2304,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2337,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2388,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2405,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2444,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2458,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl7");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2479,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2562,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2574,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2589,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2618,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2634,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-06-08 23:30:47.000000000 +0200
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_tx.c 2007-06-08 23:30:47.000000000 +0200
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -397,7 +402,7 @@
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -432,7 +437,7 @@
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
@@ -446,7 +451,7 @@
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
@@ -458,13 +463,14 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -481,14 +487,14 @@
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_wx.c 2007-06-08 23:30:47.000000000 +0200
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -281,7 +282,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +292,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +315,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +327,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +341,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +419,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +431,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +471,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_orig/ieee80211/Makefile rtl8187_rawtx/ieee80211/Makefile
--- rtl8187_orig/ieee80211/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Makefile 2007-05-27 10:47:26.000000000 +0200
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_orig/Makefile rtl8187_rawtx/Makefile
--- rtl8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/Makefile 2007-05-26 10:39:10.000000000 +0200
@@ -0,0 +1,36 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_orig/symvers rtl8187_rawtx/symvers
--- rtl8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/symvers 2007-05-26 10:39:22.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd .. |
Patch | aircrack-ng/patches/old/rtl8187_2.6.21v3.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211_crypt.h rtl8187_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_orig/beta-8187/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211_crypt.h 2007-06-21 23:44:38.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_rawtx/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211.h 2007-06-21 23:44:38.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/beta-8187/Makefile rtl8187_rawtx/beta-8187/Makefile
--- rtl8187_orig/beta-8187/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/Makefile 2007-05-27 10:47:14.000000000 +0200
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_93cx6.c 2007-06-21 23:44:42.000000000 +0200
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_rawtx/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_hw.h 2007-06-21 23:44:38.000000000 +0200
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.c 2007-06-21 23:44:42.000000000 +0200
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.h 2007-06-21 23:44:38.000000000 +0200
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c 2007-06-21 23:44:42.000000000 +0200
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 0
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,47 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
+
+
max_cck_power_level = 15;
//min_cck_power_level = 0;
max_ofdm_power_level = 25; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+
for(i=0;i<8;i++){
-
+
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +481,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +510,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +556,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +625,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +680,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +710,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +740,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +771,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +798,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +823,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +851,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +901,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +914,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x9d); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +979,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1006,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1023,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_rawtx/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_wx.c 2007-06-21 23:44:42.000000000 +0200
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,186 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +265,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +298,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +322,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +346,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +365,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +417,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +448,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +456,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +476,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +526,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +564,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +582,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +612,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +650,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +702,49 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +757,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_rawtx/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187_core.c 2007-06-21 23:44:42.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,21 +414,22 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -430,7 +443,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +460,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +472,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +481,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +500,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +536,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +552,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +574,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +596,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +615,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +629,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +651,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +771,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +815,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +840,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +878,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +905,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +922,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +947,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +959,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +972,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +988,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +998,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1014,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1038,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1070,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1121,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1134,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1148,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1169,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1201,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1216,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1231,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1240,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1248,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1296,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1315,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1373,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,31 +1384,38 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
priv->stats.txnperr++;
kfree(tx_urb->transfer_buffer);
usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_np_pending);
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ atomic_dec(&priv->tx_np_pending);
+ }
//rtl8180_try_wake_queue(dev,NORM_PRIORITY);
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1425,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1438,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1480,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1497,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1596,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1607,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1628,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1655,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1682,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1723,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1770,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1830,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1878,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1887,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1970,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2005,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2034,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2054,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2078,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2124,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2190,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2213,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2227,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2271,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2410,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2428,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2448,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2459,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2472,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2582,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2601,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2623,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2671,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2688,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2705,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2718,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2733,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_rawtx/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187.h 2007-06-21 23:44:38.000000000 +0200
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,17 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +167,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +180,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +234,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +248,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.c 2007-06-08 23:30:47.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.h 2007-06-08 23:30:44.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,19 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +412,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +424,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +472,26 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,13 +525,22 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
@@ -445,15 +552,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +599,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +611,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +649,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +665,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +673,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +682,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +700,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +716,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +761,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +791,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +818,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,21 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +210,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +240,22 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +276,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +290,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +303,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +312,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_rawtx/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211.h 2007-06-08 23:30:44.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_module.c 2007-06-08 23:30:47.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_rx.c 2007-06-08 23:30:47.000000000 +0200
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +130,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +160,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +199,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +212,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +222,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +244,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,8 +253,8 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
@@ -253,7 +319,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +360,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +370,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +405,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +415,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +433,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -444,7 +510,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -483,7 +549,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +567,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +595,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +621,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -575,7 +641,7 @@
#endif
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -606,7 +672,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +685,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +696,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +730,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +740,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +760,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +788,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +829,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +962,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +979,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1030,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1057,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1080,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1147,7 +1213,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,7 +1221,7 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
@@ -1172,7 +1238,7 @@
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1204,7 +1270,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1305,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1262,11 +1328,11 @@
spin_lock_irqsave(&ieee->lock, flags);
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1372,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1321,15 +1387,15 @@
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
@@ -1339,7 +1405,7 @@
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1347,7 +1413,7 @@
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1421,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac.c 2007-06-21 23:51:28.000000000 +0200
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,208 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,103 +879,109 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
@@ -977,62 +989,67 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1060,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1085,18 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1089,42 +1106,40 @@
}
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1147,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1207,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1300,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1327,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1466,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1477,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1620,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1645,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1659,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1676,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1706,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1728,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1756,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1779,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
{
-
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1876,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1907,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1952,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1962,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2014,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
- ieee80211_disassociate(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
+
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2138,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2170,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2247,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2268,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2280,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2304,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2337,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2388,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2405,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2444,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2458,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2479,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2562,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2574,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2589,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2618,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2634,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-06-08 23:30:47.000000000 +0200
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_tx.c 2007-06-08 23:30:47.000000000 +0200
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -397,7 +402,7 @@
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -432,7 +437,7 @@
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
@@ -446,7 +451,7 @@
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
@@ -458,13 +463,14 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -481,14 +487,14 @@
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_wx.c 2007-06-08 23:30:47.000000000 +0200
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -281,7 +282,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +292,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +315,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +327,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +341,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +419,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +431,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +471,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_orig/ieee80211/Makefile rtl8187_rawtx/ieee80211/Makefile
--- rtl8187_orig/ieee80211/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Makefile 2007-05-27 10:47:26.000000000 +0200
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_orig/ieee80211/Modules.symvers rtl8187_rawtx/ieee80211/Modules.symvers
--- rtl8187_orig/ieee80211/Modules.symvers 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_orig/Makefile rtl8187_rawtx/Makefile
--- rtl8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/Makefile 2007-06-21 23:43:15.000000000 +0200
@@ -0,0 +1,39 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -find /lib/modules/$(shell uname -r) -name rtl8187.ko -exec mv -v {} ~/ \;
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_orig/symvers rtl8187_rawtx/symvers
--- rtl8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/symvers 2007-05-26 10:39:22.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_orig/wlan0rmv rtl8187_rawtx/wlan0rmv
--- rtl8187_orig/wlan0rmv 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/wlan0rmv 2007-06-21 23:43:25.000000000 +0200
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmor rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
Patch | aircrack-ng/patches/old/rtl8187_2.6.21v4.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211_crypt.h rtl8187_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_orig/beta-8187/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211_crypt.h 2007-06-21 23:44:38.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_rawtx/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211.h 2007-06-21 23:44:38.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/beta-8187/Makefile rtl8187_rawtx/beta-8187/Makefile
--- rtl8187_orig/beta-8187/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/Makefile 2007-05-27 10:47:14.000000000 +0200
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_93cx6.c 2007-06-21 23:44:42.000000000 +0200
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_rawtx/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_hw.h 2007-06-21 23:44:38.000000000 +0200
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.c 2007-06-21 23:44:42.000000000 +0200
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.h 2007-06-21 23:44:38.000000000 +0200
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c 2007-06-25 23:58:06.000000000 +0200
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 1
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,47 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
+
+
max_cck_power_level = 15;
//min_cck_power_level = 0;
max_ofdm_power_level = 25; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+
for(i=0;i<8;i++){
-
+
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +481,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +510,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +556,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +625,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +680,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +710,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +740,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +771,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +798,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +823,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +851,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +901,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +914,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x86); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +979,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1006,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1023,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_rawtx/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_wx.c 2007-06-21 23:44:42.000000000 +0200
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,186 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +265,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +298,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +322,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +346,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +365,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +417,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +448,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +456,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +476,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +526,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +564,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +582,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +612,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +650,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +702,49 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +757,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_rawtx/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187_core.c 2007-06-21 23:44:42.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,21 +414,22 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -430,7 +443,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +460,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +472,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +481,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +500,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +536,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +552,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +574,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +596,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +615,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +629,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +651,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +771,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +815,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +840,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +878,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +905,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +922,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +947,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +959,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +972,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +988,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +998,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1014,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1038,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1070,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1121,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1134,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1148,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1169,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1201,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1216,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1231,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1240,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1248,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1296,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1315,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1373,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,31 +1384,38 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
priv->stats.txnperr++;
kfree(tx_urb->transfer_buffer);
usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_np_pending);
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ atomic_dec(&priv->tx_np_pending);
+ }
//rtl8180_try_wake_queue(dev,NORM_PRIORITY);
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1425,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1438,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1480,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1497,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1596,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1607,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1628,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1655,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1682,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1723,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1770,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1830,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1878,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1887,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1970,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2005,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2034,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2054,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2078,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2124,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2190,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2213,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2227,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2271,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2410,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2428,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2448,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2459,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2472,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2582,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2601,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2623,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2671,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2688,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2705,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2718,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2733,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_rawtx/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187.h 2007-06-21 23:44:38.000000000 +0200
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,17 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +167,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +180,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +234,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +248,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.c 2007-06-08 23:30:47.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.h 2007-06-08 23:30:44.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,19 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +412,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +424,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +472,26 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,13 +525,22 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
@@ -445,15 +552,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +599,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +611,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +649,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +665,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +673,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +682,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +700,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +716,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +761,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +791,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +818,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-06-08 23:30:47.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,21 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +210,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +240,22 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +276,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +290,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +303,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +312,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_rawtx/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211.h 2007-06-08 23:30:44.000000000 +0200
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -1015,10 +1031,16 @@
struct timer_list beacon_timer;
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
struct workqueue_struct *wq;
@@ -1154,12 +1176,12 @@
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-extern int ieee80211_xmit(struct sk_buff *skb,
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern const long ieee80211_wlan_frequencies[];
+extern const long ieee80211_wlan_frequencies_rtl7[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_module.c 2007-06-08 23:30:47.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_rx.c 2007-06-08 23:30:47.000000000 +0200
@@ -22,7 +22,6 @@
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +130,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +160,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +199,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +212,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +222,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +244,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,8 +253,8 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
@@ -253,7 +319,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +360,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +370,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +405,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +415,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +433,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -444,7 +510,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -483,7 +549,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +567,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +595,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +621,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -575,7 +641,7 @@
#endif
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -606,7 +672,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +685,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +696,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +730,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +740,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +760,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +788,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +829,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +962,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +979,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1030,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1057,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1080,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1147,7 +1213,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,7 +1221,7 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
@@ -1172,7 +1238,7 @@
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1204,7 +1270,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1305,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1262,11 +1328,11 @@
spin_lock_irqsave(&ieee->lock, flags);
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1372,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1321,15 +1387,15 @@
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
@@ -1339,7 +1405,7 @@
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1347,7 +1413,7 @@
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1421,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac.c 2007-06-21 23:51:28.000000000 +0200
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,208 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,103 +879,109 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
@@ -977,62 +989,67 @@
printk(KERN_INFO"Using B rates\n");
}
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1060,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1085,18 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1089,42 +1106,40 @@
}
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1147,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1207,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1300,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1327,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1466,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1477,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1620,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1645,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1659,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1676,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1706,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1728,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1756,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1779,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
{
-
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1876,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1907,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1952,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1962,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2014,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
- ieee80211_disassociate(ieee);
+ ieee80211_stop_scan_rtl7(ieee);
+
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2138,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2170,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2247,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2268,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2280,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2304,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2337,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2388,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2405,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2444,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2458,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2479,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2562,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2574,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2589,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2618,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2634,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-06-08 23:30:47.000000000 +0200
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_tx.c 2007-06-08 23:30:47.000000000 +0200
@@ -32,7 +32,6 @@
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -397,7 +402,7 @@
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -432,7 +437,7 @@
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
@@ -446,7 +451,7 @@
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
@@ -458,13 +463,14 @@
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -481,14 +487,14 @@
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_wx.c 2007-06-08 23:30:47.000000000 +0200
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -281,7 +282,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +292,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +315,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +327,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +341,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +419,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +431,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +471,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_orig/ieee80211/Makefile rtl8187_rawtx/ieee80211/Makefile
--- rtl8187_orig/ieee80211/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Makefile 2007-05-27 10:47:26.000000000 +0200
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_orig/ieee80211/Modules.symvers rtl8187_rawtx/ieee80211/Modules.symvers
--- rtl8187_orig/ieee80211/Modules.symvers 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_orig/Makefile rtl8187_rawtx/Makefile
--- rtl8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/Makefile 2007-06-21 23:43:15.000000000 +0200
@@ -0,0 +1,39 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -find /lib/modules/$(shell uname -r) -name rtl8187.ko -exec mv -v {} ~/ \;
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_orig/symvers rtl8187_rawtx/symvers
--- rtl8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/symvers 2007-05-26 10:39:22.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_orig/wlan0rmv rtl8187_rawtx/wlan0rmv
--- rtl8187_orig/wlan0rmv 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/wlan0rmv 2007-06-26 16:32:43.000000000 +0200
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmod rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
Patch | aircrack-ng/patches/old/rtl8187_2.6.21v5.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211_crypt.h rtl8187_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_orig/beta-8187/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211_crypt.h 2007-07-13 01:46:27.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_rawtx/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211.h 2007-07-13 01:46:27.000000000 +0200
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_orig/beta-8187/Makefile rtl8187_rawtx/beta-8187/Makefile
--- rtl8187_orig/beta-8187/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/Makefile 2007-05-27 10:47:14.000000000 +0200
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_93cx6.c 2007-07-13 01:46:24.000000000 +0200
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_rawtx/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_hw.h 2007-07-13 01:46:27.000000000 +0200
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.c 2007-07-13 01:46:24.000000000 +0200
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.h 2007-07-13 01:46:27.000000000 +0200
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c 2007-07-13 01:46:24.000000000 +0200
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 1
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,47 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
+
+
max_cck_power_level = 15;
//min_cck_power_level = 0;
max_ofdm_power_level = 25; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+
for(i=0;i<8;i++){
-
+
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +481,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +510,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +556,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +625,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +680,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +710,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +740,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +771,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +798,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +823,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +851,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +901,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +914,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x86); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +979,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1006,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1023,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_rawtx/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_wx.c 2007-07-13 01:46:24.000000000 +0200
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,186 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +265,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +298,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +322,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +346,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +365,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +417,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +448,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +456,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +476,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +526,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +564,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +582,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +612,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +650,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +702,49 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +757,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_rawtx/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187_core.c 2007-07-13 01:46:24.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,21 +414,22 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -430,7 +443,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +460,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +472,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +481,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +500,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +536,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +552,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +574,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +596,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +615,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +629,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +651,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +771,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +815,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +840,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +878,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +905,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +922,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +947,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +959,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +972,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +988,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +998,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1014,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1038,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1070,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1121,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1134,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1148,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1169,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1201,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1216,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1231,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1240,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1248,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1296,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1315,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1373,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1384,20 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1409,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1422,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1435,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1477,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1494,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1593,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1604,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1625,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1652,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1679,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1720,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1767,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1827,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1875,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1884,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1967,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2002,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2031,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2051,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2075,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2121,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2187,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2210,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2224,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2268,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2407,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2425,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2445,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2456,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2469,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2579,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2598,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2620,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2668,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2685,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2702,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2715,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2730,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_rawtx/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187.h 2007-07-13 01:46:27.000000000 +0200
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,17 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +167,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +180,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +234,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +248,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.c 2007-07-13 01:46:05.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-07-13 01:46:05.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.h 2007-07-13 01:46:10.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-07-13 01:46:05.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,19 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +412,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +424,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +472,26 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,13 +525,22 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
@@ -445,15 +552,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +599,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +611,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +649,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +665,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +673,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +682,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +700,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +716,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +761,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +791,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +818,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-07-13 01:46:05.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,21 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +210,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +240,22 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +276,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +290,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +303,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +312,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_rawtx/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211.h 2007-07-13 01:46:10.000000000 +0200
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_module.c 2007-07-13 01:46:05.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_rx.c 2007-07-13 01:46:05.000000000 +0200
@@ -13,16 +13,15 @@
* more details.
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
-
+
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,85 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +130,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +160,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +199,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +212,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +222,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +244,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,13 +253,13 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
-
+
return 0;
-
+
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
@@ -253,7 +319,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +360,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +370,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +405,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +415,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +433,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -413,7 +479,7 @@
last_seq = &ieee->last_seq_num;
last_frag = &ieee->last_frag_num;
last_time = &ieee->last_packet_time;
-
+
break;
default:
return 0;
@@ -436,7 +502,7 @@
drop:
// BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
// printk("DUP\n");
-
+
return 1;
}
@@ -444,7 +510,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -481,9 +547,9 @@
type = WLAN_FC_GET_TYPE(fc);
stype = WLAN_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctl);
-
+
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +567,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +595,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +621,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -573,9 +639,9 @@
goto rx_dropped;
}
#endif
-
-
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+
+
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -583,7 +649,7 @@
/* Data frame - extract src/dst addresses */
-
+
switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN);
@@ -606,7 +672,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +685,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +696,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +730,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +740,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +760,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +788,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +829,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -896,7 +962,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +979,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1030,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1057,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1080,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1043,47 +1109,47 @@
break;
case MFIE_TYPE_TIM:
-
- if(info_element->len < 4)
+
+ if(info_element->len < 4)
break;
-
+
network->dtim_period = info_element->data[1];
-
+
if(ieee->state != IEEE80211_LINKED)
break;
-
- network->last_dtim_sta_time[0] = stats->mac_time[0];
+
+ network->last_dtim_sta_time[0] = stats->mac_time[0];
network->last_dtim_sta_time[1] = stats->mac_time[1];
-
+
network->dtim_data = IEEE80211_DTIM_VALID;
-
- if(info_element->data[0] != 0)
+
+ if(info_element->data[0] != 0)
break;
-
+
if(info_element->data[2] & 1)
network->dtim_data |= IEEE80211_DTIM_MBCAST;
-
+
offset = (info_element->data[2] >> 1)*2;
-
- //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
-
- if(ieee->assoc_id < offset ||
+
+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
+
+ if(ieee->assoc_id < offset ||
ieee->assoc_id > 8*(offset + info_element->len -3))
-
+
break;
-
-
+
+
offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ;
-
- // printk("offset:%x data:%x, ucast:%d\n", offset,
+
+ // printk("offset:%x data:%x, ucast:%d\n", offset,
// info_element->data[3+offset] ,
// info_element->data[3+offset] & (1<<(ieee->assoc_id%8)));
-
+
if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
network->dtim_data |= IEEE80211_DTIM_UCAST;
-
+
break;
-
+
case MFIE_TYPE_IBSS_SET:
IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n");
break;
@@ -1115,7 +1181,7 @@
memcpy(network->rsn_ie, info_element,
network->rsn_ie_len);
break;
-
+
default:
IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
info_element->id);
@@ -1147,7 +1213,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,24 +1221,24 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
- * and the capability field (in particular IBSS and BSS) all match.
+ * and the capability field (in particular IBSS and BSS) all match.
* We treat all <hidden> with the same BSSID and channel
* as one network */
return ((src->ssid_len == dst->ssid_len) &&
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
- ((src->capability & WLAN_CAPABILITY_IBSS) ==
+ ((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
- ((src->capability & WLAN_CAPABILITY_BSS) ==
+ ((src->capability & WLAN_CAPABILITY_BSS) ==
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1194,7 +1260,7 @@
dst->dtim_data = src->dtim_data;
dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
-
+
memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len);
dst->wpa_ie_len = src->wpa_ie_len;
memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
@@ -1204,7 +1270,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1305,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1261,12 +1327,12 @@
* already there. */
spin_lock_irqsave(&ieee->lock, flags);
-
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
-
+
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
+
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1372,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1315,39 +1381,39 @@
WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
-
+
/* we have an entry and we are going to update it. But this entry may
- * be already expired. In this case we do the same as we found a new
+ * be already expired. In this case we do the same as we found a new
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_BEACON:
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
-
+
case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1421,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac.c 2007-07-13 01:46:05.000000000 +0200
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,211 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
+ if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE);
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,166 +882,181 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1067,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1092,19 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
- printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+ printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10));
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1087,44 +1112,45 @@
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1158,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1218,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1311,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1338,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1477,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1488,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1631,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1656,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1670,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1687,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1717,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1739,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1767,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1790,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
{
-
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1887,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1918,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
- ieee->rate = 540;
+
+// ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
- ieee->rate = 110;
+// ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1963,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1973,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2025,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
+
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2149,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2181,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2258,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2279,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2291,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2315,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2348,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2399,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2416,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2455,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2469,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2490,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2573,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2585,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2600,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2629,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2645,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-07-13 01:46:05.000000000 +0200
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_tx.c 2007-07-13 01:46:05.000000000 +0200
@@ -24,15 +24,14 @@
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -299,27 +304,27 @@
}
if(likely(ieee->raw_tx == 0)){
-
+
if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
-
+
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-
+
crypt = ieee->crypt[ieee->tx_keyidx];
-
+
encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
ieee->host_encrypt && crypt && crypt->ops;
-
+
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
stats->tx_dropped++;
goto success;
}
-
+
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !encrypt && ether_type == ETH_P_PAE) {
struct eapol *eap = (struct eapol *)(skb->data +
@@ -328,23 +333,23 @@
eap_get_type(eap->type));
}
#endif
-
+
/* Save source and destination addresses */
memcpy(&dest, skb->data, ETH_ALEN);
memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
-
+
/* Advance the SKB to the start of the payload */
skb_pull(skb, sizeof(struct ethhdr));
-
+
/* Determine total amount of storage required for TXB packets */
bytes = skb->len + SNAP_SIZE + sizeof(u16);
-
+
if (encrypt)
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_WEP;
else
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
-
+
if (ieee->iw_mode == IW_MODE_INFRA) {
fc |= IEEE80211_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -360,9 +365,9 @@
memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
}
header.frame_ctl = cpu_to_le16(fc);
-
+
hdr_len = IEEE80211_3ADDR_LEN;
-
+
/* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */
if (is_multicast_ether_addr(dest) ||
@@ -370,7 +375,7 @@
frag_size = MAX_FRAG_THRESHOLD;
else
frag_size = ieee->fts;
-
+
/* Determine amount of payload per fragment. Regardless of if
* this stack is providing the full 802.11 header, one will
* eventually be affixed to this fragment -- so we must account for
@@ -379,12 +384,12 @@
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
bytes_per_frag -= IEEE80211_FCS_LEN;
-
+
/* Each fragment may need to have room for encryptiong pre/postfix */
if (encrypt)
bytes_per_frag -= crypt->ops->extra_prefix_len +
crypt->ops->extra_postfix_len;
-
+
/* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */
nr_frags = bytes / bytes_per_frag;
@@ -393,11 +398,11 @@
nr_frags++;
else
bytes_last_frag = bytes_per_frag;
-
+
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -405,93 +410,94 @@
}
txb->encrypted = encrypt;
txb->payload_size = bytes;
-
+
for (i = 0; i < nr_frags; i++) {
skb_frag = txb->fragments[i];
-
+
if (encrypt)
skb_reserve(skb_frag, crypt->ops->extra_prefix_len);
-
+
frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len);
memcpy(frag_hdr, &header, hdr_len);
-
+
/* If this is not the last fragment, then add the MOREFRAGS
* bit to the frame control */
if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16(
fc | IEEE80211_FCTL_MOREFRAGS);
bytes = bytes_per_frag;
-
+
} else {
/* The last fragment takes the remaining length */
bytes = bytes_last_frag;
}
-
+
frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i);
-
-
+
+
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
}
-
+
memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
-
+
/* Advance the SKB... */
skb_pull(skb, bytes);
-
+
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
}
- // Advance sequence number in data frame.
+ // Advance sequence number in data frame.
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
- }
+ }
success:
spin_unlock_irqrestore(&ieee->lock, flags);
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
-
-
+
+
}
return 0;
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_wx.c 2007-07-13 01:46:05.000000000 +0200
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -259,6 +260,9 @@
int i, key, key_provided, len;
struct ieee80211_crypt_data **crypt;
+ if (erq->flags & IW_ENCODE_RESTRICTED)
+ return -EINVAL;
+
IEEE80211_DEBUG_WX("SET_ENCODE\n");
key = erq->flags & IW_ENCODE_INDEX;
@@ -281,7 +285,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +295,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +318,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +330,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +344,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +422,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +434,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +474,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_orig/ieee80211/Makefile rtl8187_rawtx/ieee80211/Makefile
--- rtl8187_orig/ieee80211/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Makefile 2007-05-27 10:47:26.000000000 +0200
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_orig/ieee80211/Modules.symvers rtl8187_rawtx/ieee80211/Modules.symvers
--- rtl8187_orig/ieee80211/Modules.symvers 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_orig/Makefile rtl8187_rawtx/Makefile
--- rtl8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/Makefile 2007-06-21 23:43:15.000000000 +0200
@@ -0,0 +1,39 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -find /lib/modules/$(shell uname -r) -name rtl8187.ko -exec mv -v {} ~/ \;
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_orig/symvers rtl8187_rawtx/symvers
--- rtl8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/symvers 2007-05-26 10:39:22.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_orig/wlan0rmv rtl8187_rawtx/wlan0rmv
--- rtl8187_orig/wlan0rmv 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/wlan0rmv 2007-06-26 16:32:43.000000000 +0200
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmod rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
Patch | aircrack-ng/patches/old/rtl8187_2.6.22.patch | diff -Naur rtl8187_orig/beta-8187/ieee80211_crypt.h rtl8187_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_orig/beta-8187/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211_crypt.h 2007-07-13 01:46:27.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/beta-8187/ieee80211.h rtl8187_rawtx/beta-8187/ieee80211.h
--- rtl8187_orig/beta-8187/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/ieee80211.h 2007-07-13 01:46:27.000000000 +0200
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_orig/beta-8187/Makefile rtl8187_rawtx/beta-8187/Makefile
--- rtl8187_orig/beta-8187/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/Makefile 2007-05-27 10:47:14.000000000 +0200
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_orig/beta-8187/r8180_93cx6.c rtl8187_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_orig/beta-8187/r8180_93cx6.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_93cx6.c 2007-07-13 01:46:24.000000000 +0200
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_orig/beta-8187/r8180_hw.h rtl8187_rawtx/beta-8187/r8180_hw.h
--- rtl8187_orig/beta-8187/r8180_hw.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_hw.h 2007-07-13 01:46:27.000000000 +0200
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.c rtl8187_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_orig/beta-8187/r8180_rtl8225.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.c 2007-07-13 01:46:24.000000000 +0200
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225.h rtl8187_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_orig/beta-8187/r8180_rtl8225.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225.h 2007-07-13 01:46:27.000000000 +0200
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_orig/beta-8187/r8180_rtl8225z2.c rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_orig/beta-8187/r8180_rtl8225z2.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_rtl8225z2.c 2007-07-13 01:46:24.000000000 +0200
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 1
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,47 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
+
+
max_cck_power_level = 15;
//min_cck_power_level = 0;
max_ofdm_power_level = 25; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+
for(i=0;i<8;i++){
-
+
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +481,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +510,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +556,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +625,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +680,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +710,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +740,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +771,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +798,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +823,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +851,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +901,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +914,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x86); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +979,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1006,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1023,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_orig/beta-8187/r8180_wx.c rtl8187_rawtx/beta-8187/r8180_wx.c
--- rtl8187_orig/beta-8187/r8180_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8180_wx.c 2007-07-13 01:46:24.000000000 +0200
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,186 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +265,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +298,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +322,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +346,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +365,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +417,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +448,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +456,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +476,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +526,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +564,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +582,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +612,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +650,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +702,49 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +757,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_orig/beta-8187/r8187_core.c rtl8187_rawtx/beta-8187/r8187_core.c
--- rtl8187_orig/beta-8187/r8187_core.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187_core.c 2007-07-13 01:46:24.000000000 +0200
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,21 +414,22 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
}
@@ -430,7 +443,7 @@
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +460,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +472,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +481,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +500,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +536,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +552,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +574,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +596,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +615,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +629,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +651,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +771,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +815,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +840,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +878,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +905,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +922,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +947,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +959,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +972,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +988,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +998,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1014,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1038,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1070,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1121,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1134,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1148,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1169,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1201,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1216,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1231,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1240,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1248,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1296,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1315,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1373,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1384,20 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1409,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1422,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1435,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1477,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1494,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1593,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1604,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1625,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1652,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1679,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1720,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1767,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1827,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1875,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1884,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1967,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2002,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2031,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2051,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2075,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2121,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2187,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2210,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2224,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2268,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2407,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2425,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2445,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2456,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2469,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2579,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2598,20 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2620,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2668,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2685,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2702,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2715,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2730,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_orig/beta-8187/r8187.h rtl8187_rawtx/beta-8187/r8187.h
--- rtl8187_orig/beta-8187/r8187.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/beta-8187/r8187.h 2007-07-13 01:46:27.000000000 +0200
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,17 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +167,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +180,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +234,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +248,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.c rtl8187_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_orig/ieee80211/ieee80211_crypt.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.c 2007-07-13 01:46:05.000000000 +0200
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_ccmp.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2007-07-13 01:46:05.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt.h rtl8187_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_orig/ieee80211/ieee80211_crypt.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt.h 2007-07-13 01:46:10.000000000 +0200
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_tkip.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_tkip.c 2007-07-13 01:46:05.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,19 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +412,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +424,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +472,26 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,13 +525,22 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
@@ -445,15 +552,24 @@
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +599,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +611,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +649,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +665,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +673,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +682,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +700,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +716,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +761,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +791,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +818,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_crypt_wep.c rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_orig/ieee80211/ieee80211_crypt_wep.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_crypt_wep.c 2007-07-13 01:46:05.000000000 +0200
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,21 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +210,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +240,22 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +276,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +290,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +303,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +312,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211.h rtl8187_rawtx/ieee80211/ieee80211.h
--- rtl8187_orig/ieee80211/ieee80211.h 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211.h 2007-07-13 01:46:10.000000000 +0200
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_orig/ieee80211/ieee80211_module.c rtl8187_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_orig/ieee80211/ieee80211_module.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_module.c 2007-07-13 01:46:05.000000000 +0200
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_rx.c rtl8187_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_orig/ieee80211/ieee80211_rx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_rx.c 2007-07-29 10:28:57.000000000 +0200
@@ -13,16 +13,15 @@
* more details.
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
-
+
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,89 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+#else
+ skb_reset_mac_header(skb);
+#endif
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +134,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +164,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +203,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +216,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +226,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +248,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,13 +257,13 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
-
+
return 0;
-
+
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
@@ -253,7 +323,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +364,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +374,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +409,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +419,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +437,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -413,7 +483,7 @@
last_seq = &ieee->last_seq_num;
last_frag = &ieee->last_frag_num;
last_time = &ieee->last_packet_time;
-
+
break;
default:
return 0;
@@ -436,7 +506,7 @@
drop:
// BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
// printk("DUP\n");
-
+
return 1;
}
@@ -444,7 +514,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -481,9 +551,9 @@
type = WLAN_FC_GET_TYPE(fc);
stype = WLAN_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctl);
-
+
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +571,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +599,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +625,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -573,9 +643,9 @@
goto rx_dropped;
}
#endif
-
-
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+
+
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -583,7 +653,7 @@
/* Data frame - extract src/dst addresses */
-
+
switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN);
@@ -606,7 +676,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +689,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +700,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +734,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +744,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +764,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +792,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +833,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -861,7 +931,12 @@
if (skb2 != NULL) {
/* send to wireless media */
skb2->protocol = __constant_htons(ETH_P_802_3);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb2->mac.raw = skb2->nh.raw = skb2->data;
+#else
+ skb_reset_mac_header(skb2);
+ skb_reset_network_header(skb2);
+#endif
/* skb2->nh.raw = skb2->data + ETH_HLEN; */
skb2->dev = dev;
dev_queue_xmit(skb2);
@@ -896,7 +971,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +988,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1039,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1066,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1089,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1043,47 +1118,47 @@
break;
case MFIE_TYPE_TIM:
-
- if(info_element->len < 4)
+
+ if(info_element->len < 4)
break;
-
+
network->dtim_period = info_element->data[1];
-
+
if(ieee->state != IEEE80211_LINKED)
break;
-
- network->last_dtim_sta_time[0] = stats->mac_time[0];
+
+ network->last_dtim_sta_time[0] = stats->mac_time[0];
network->last_dtim_sta_time[1] = stats->mac_time[1];
-
+
network->dtim_data = IEEE80211_DTIM_VALID;
-
- if(info_element->data[0] != 0)
+
+ if(info_element->data[0] != 0)
break;
-
+
if(info_element->data[2] & 1)
network->dtim_data |= IEEE80211_DTIM_MBCAST;
-
+
offset = (info_element->data[2] >> 1)*2;
-
- //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
-
- if(ieee->assoc_id < offset ||
+
+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
+
+ if(ieee->assoc_id < offset ||
ieee->assoc_id > 8*(offset + info_element->len -3))
-
+
break;
-
-
+
+
offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ;
-
- // printk("offset:%x data:%x, ucast:%d\n", offset,
+
+ // printk("offset:%x data:%x, ucast:%d\n", offset,
// info_element->data[3+offset] ,
// info_element->data[3+offset] & (1<<(ieee->assoc_id%8)));
-
+
if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
network->dtim_data |= IEEE80211_DTIM_UCAST;
-
+
break;
-
+
case MFIE_TYPE_IBSS_SET:
IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n");
break;
@@ -1115,7 +1190,7 @@
memcpy(network->rsn_ie, info_element,
network->rsn_ie_len);
break;
-
+
default:
IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
info_element->id);
@@ -1147,7 +1222,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,24 +1230,24 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
- * and the capability field (in particular IBSS and BSS) all match.
+ * and the capability field (in particular IBSS and BSS) all match.
* We treat all <hidden> with the same BSSID and channel
* as one network */
return ((src->ssid_len == dst->ssid_len) &&
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
- ((src->capability & WLAN_CAPABILITY_IBSS) ==
+ ((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
- ((src->capability & WLAN_CAPABILITY_BSS) ==
+ ((src->capability & WLAN_CAPABILITY_BSS) ==
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1194,7 +1269,7 @@
dst->dtim_data = src->dtim_data;
dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
-
+
memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len);
dst->wpa_ie_len = src->wpa_ie_len;
memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
@@ -1204,7 +1279,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1314,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1261,12 +1336,12 @@
* already there. */
spin_lock_irqsave(&ieee->lock, flags);
-
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
-
+
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
+
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1381,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1315,39 +1390,39 @@
WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
-
+
/* we have an entry and we are going to update it. But this entry may
- * be already expired. In this case we do the same as we found a new
+ * be already expired. In this case we do the same as we found a new
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_BEACON:
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
-
+
case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1430,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac.c rtl8187_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_orig/ieee80211/ieee80211_softmac.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac.c 2007-07-13 01:46:05.000000000 +0200
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,211 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
+ if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE);
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,166 +882,181 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1067,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1092,19 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
- printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+ printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10));
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1087,44 +1112,45 @@
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1158,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1218,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1311,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1338,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1477,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1488,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1631,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1656,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1670,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1687,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1717,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1739,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1767,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1790,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
{
-
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1887,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1918,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
- ieee->rate = 540;
+
+// ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
- ieee->rate = 110;
+// ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1963,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1973,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2025,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
+
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2149,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2181,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2258,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2279,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2291,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2315,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2348,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2399,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2416,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2455,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2469,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2490,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2573,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2585,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2600,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2629,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2645,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_softmac_wx.c rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_orig/ieee80211/ieee80211_softmac_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_softmac_wx.c 2007-07-13 01:46:05.000000000 +0200
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_tx.c rtl8187_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_orig/ieee80211/ieee80211_tx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_tx.c 2007-07-13 01:46:05.000000000 +0200
@@ -24,15 +24,14 @@
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -299,27 +304,27 @@
}
if(likely(ieee->raw_tx == 0)){
-
+
if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
-
+
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-
+
crypt = ieee->crypt[ieee->tx_keyidx];
-
+
encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
ieee->host_encrypt && crypt && crypt->ops;
-
+
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
stats->tx_dropped++;
goto success;
}
-
+
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !encrypt && ether_type == ETH_P_PAE) {
struct eapol *eap = (struct eapol *)(skb->data +
@@ -328,23 +333,23 @@
eap_get_type(eap->type));
}
#endif
-
+
/* Save source and destination addresses */
memcpy(&dest, skb->data, ETH_ALEN);
memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
-
+
/* Advance the SKB to the start of the payload */
skb_pull(skb, sizeof(struct ethhdr));
-
+
/* Determine total amount of storage required for TXB packets */
bytes = skb->len + SNAP_SIZE + sizeof(u16);
-
+
if (encrypt)
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_WEP;
else
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
-
+
if (ieee->iw_mode == IW_MODE_INFRA) {
fc |= IEEE80211_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -360,9 +365,9 @@
memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
}
header.frame_ctl = cpu_to_le16(fc);
-
+
hdr_len = IEEE80211_3ADDR_LEN;
-
+
/* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */
if (is_multicast_ether_addr(dest) ||
@@ -370,7 +375,7 @@
frag_size = MAX_FRAG_THRESHOLD;
else
frag_size = ieee->fts;
-
+
/* Determine amount of payload per fragment. Regardless of if
* this stack is providing the full 802.11 header, one will
* eventually be affixed to this fragment -- so we must account for
@@ -379,12 +384,12 @@
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
bytes_per_frag -= IEEE80211_FCS_LEN;
-
+
/* Each fragment may need to have room for encryptiong pre/postfix */
if (encrypt)
bytes_per_frag -= crypt->ops->extra_prefix_len +
crypt->ops->extra_postfix_len;
-
+
/* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */
nr_frags = bytes / bytes_per_frag;
@@ -393,11 +398,11 @@
nr_frags++;
else
bytes_last_frag = bytes_per_frag;
-
+
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -405,93 +410,94 @@
}
txb->encrypted = encrypt;
txb->payload_size = bytes;
-
+
for (i = 0; i < nr_frags; i++) {
skb_frag = txb->fragments[i];
-
+
if (encrypt)
skb_reserve(skb_frag, crypt->ops->extra_prefix_len);
-
+
frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len);
memcpy(frag_hdr, &header, hdr_len);
-
+
/* If this is not the last fragment, then add the MOREFRAGS
* bit to the frame control */
if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16(
fc | IEEE80211_FCTL_MOREFRAGS);
bytes = bytes_per_frag;
-
+
} else {
/* The last fragment takes the remaining length */
bytes = bytes_last_frag;
}
-
+
frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i);
-
-
+
+
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
}
-
+
memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
-
+
/* Advance the SKB... */
skb_pull(skb, bytes);
-
+
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
}
- // Advance sequence number in data frame.
+ // Advance sequence number in data frame.
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
- }
+ }
success:
spin_unlock_irqrestore(&ieee->lock, flags);
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
-
-
+
+
}
return 0;
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_orig/ieee80211/ieee80211_wx.c rtl8187_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_orig/ieee80211/ieee80211_wx.c 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/ieee80211_wx.c 2007-07-13 01:46:05.000000000 +0200
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -259,6 +260,9 @@
int i, key, key_provided, len;
struct ieee80211_crypt_data **crypt;
+ if (erq->flags & IW_ENCODE_RESTRICTED)
+ return -EINVAL;
+
IEEE80211_DEBUG_WX("SET_ENCODE\n");
key = erq->flags & IW_ENCODE_INDEX;
@@ -281,7 +285,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +295,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +318,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +330,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +344,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +422,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +434,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +474,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_orig/ieee80211/Makefile rtl8187_rawtx/ieee80211/Makefile
--- rtl8187_orig/ieee80211/Makefile 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Makefile 2007-05-27 10:47:26.000000000 +0200
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_orig/ieee80211/Modules.symvers rtl8187_rawtx/ieee80211/Modules.symvers
--- rtl8187_orig/ieee80211/Modules.symvers 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_orig/Makefile rtl8187_rawtx/Makefile
--- rtl8187_orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/Makefile 2007-06-21 23:43:15.000000000 +0200
@@ -0,0 +1,39 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -find /lib/modules/$(shell uname -r) -name rtl8187.ko -exec mv -v {} ~/ \;
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_orig/symvers rtl8187_rawtx/symvers
--- rtl8187_orig/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_rawtx/symvers 2007-05-26 10:39:22.000000000 +0200
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_orig/wlan0rmv rtl8187_rawtx/wlan0rmv
--- rtl8187_orig/wlan0rmv 2007-03-13 23:45:09.000000000 +0100
+++ rtl8187_rawtx/wlan0rmv 2007-06-26 16:32:43.000000000 +0200
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmod rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
Patch | aircrack-ng/patches/old/rtl8187_2.6.24.patch | diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h 2008-01-30 17:38:10.000000000 +0100
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h 2008-01-30 17:38:10.000000000 +0100
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile
--- rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile 2008-01-30 17:38:10.000000000 +0100
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c 2008-01-30 17:38:10.000000000 +0100
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h 2008-01-30 17:38:11.000000000 +0100
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c 2008-01-30 17:38:11.000000000 +0100
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h 2008-01-30 17:38:11.000000000 +0100
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c 2008-01-30 17:38:11.000000000 +0100
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 1
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,47 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
+
+
max_cck_power_level = 15;
//min_cck_power_level = 0;
max_ofdm_power_level = 25; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+
for(i=0;i<8;i++){
-
+
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +481,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +510,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +556,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +625,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +680,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +710,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +740,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +771,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +798,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +823,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +851,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +901,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +914,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x86); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +979,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1006,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1023,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c 2008-01-30 17:38:11.000000000 +0100
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,186 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+ if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +265,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +298,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +322,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +346,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +365,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +417,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +448,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +456,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +476,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +526,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +564,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +582,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +612,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +650,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +702,49 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +757,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c 2008-01-30 17:39:05.000000000 +0100
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,35 +414,44 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
+#else
+ rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net);
+#endif
}
void rtl8180_proc_module_remove(void)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
+#else
+ remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net);
+#endif
}
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +468,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +480,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +489,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +508,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +544,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +560,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +582,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +604,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +623,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +637,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +659,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +779,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +823,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +848,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +886,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +913,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +930,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +955,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +967,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +980,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +996,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +1006,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1022,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1046,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1078,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1129,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1142,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1156,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1177,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1209,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1224,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1239,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1248,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1256,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1304,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1323,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1381,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1392,20 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1417,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1430,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1443,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1485,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1502,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1601,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1612,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1633,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1660,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1687,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1728,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1775,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1835,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1883,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1892,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1975,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2010,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2039,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2059,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2083,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2129,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2195,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2218,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2232,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2276,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2415,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2433,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2453,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2464,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2477,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2587,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2606,22 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+#endif
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2630,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2678,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2695,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2712,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2725,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2740,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h 2008-01-30 17:38:11.000000000 +0100
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,17 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +167,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +180,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +234,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +248,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c 2008-01-30 17:38:11.000000000 +0100
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2008-01-30 17:38:11.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h 2008-01-30 17:38:11.000000000 +0100
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c 2008-01-30 17:39:05.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,23 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 2, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +416,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +428,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +476,30 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,33 +533,59 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[0].page = virt_to_page(hdr);
sg[0].offset = offset_in_page(hdr);
sg[0].length = 16;
+#else
+ sg_set_page(&sg[0], virt_to_page(hdr), 16, offset_in_page(hdr));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[1].page = virt_to_page(data);
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#else
+ sg_set_page(&sg[1], virt_to_page(data), data_len, offset_in_page(data));
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +615,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +627,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +665,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +681,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +689,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +698,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +716,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +732,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +777,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +807,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +834,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c 2008-01-30 17:39:05.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,25 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +214,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +244,26 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +284,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +298,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +311,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +320,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h 2008-01-30 17:38:11.000000000 +0100
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c 2008-01-30 17:38:11.000000000 +0100
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c 2008-01-30 17:38:11.000000000 +0100
@@ -13,16 +13,15 @@
* more details.
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
-
+
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,89 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+#else
+ skb_reset_mac_header(skb);
+#endif
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +134,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +164,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +203,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +216,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +226,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +248,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,13 +257,13 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
-
+
return 0;
-
+
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
@@ -253,7 +323,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +364,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +374,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +409,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +419,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +437,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -413,7 +483,7 @@
last_seq = &ieee->last_seq_num;
last_frag = &ieee->last_frag_num;
last_time = &ieee->last_packet_time;
-
+
break;
default:
return 0;
@@ -436,7 +506,7 @@
drop:
// BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
// printk("DUP\n");
-
+
return 1;
}
@@ -444,7 +514,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -481,9 +551,9 @@
type = WLAN_FC_GET_TYPE(fc);
stype = WLAN_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctl);
-
+
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +571,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +599,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +625,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -573,9 +643,9 @@
goto rx_dropped;
}
#endif
-
-
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+
+
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -583,7 +653,7 @@
/* Data frame - extract src/dst addresses */
-
+
switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN);
@@ -606,7 +676,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +689,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +700,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +734,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +744,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +764,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +792,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +833,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -861,7 +931,12 @@
if (skb2 != NULL) {
/* send to wireless media */
skb2->protocol = __constant_htons(ETH_P_802_3);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb2->mac.raw = skb2->nh.raw = skb2->data;
+#else
+ skb_reset_mac_header(skb2);
+ skb_reset_network_header(skb2);
+#endif
/* skb2->nh.raw = skb2->data + ETH_HLEN; */
skb2->dev = dev;
dev_queue_xmit(skb2);
@@ -896,7 +971,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +988,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1039,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1066,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1089,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1043,47 +1118,47 @@
break;
case MFIE_TYPE_TIM:
-
- if(info_element->len < 4)
+
+ if(info_element->len < 4)
break;
-
+
network->dtim_period = info_element->data[1];
-
+
if(ieee->state != IEEE80211_LINKED)
break;
-
- network->last_dtim_sta_time[0] = stats->mac_time[0];
+
+ network->last_dtim_sta_time[0] = stats->mac_time[0];
network->last_dtim_sta_time[1] = stats->mac_time[1];
-
+
network->dtim_data = IEEE80211_DTIM_VALID;
-
- if(info_element->data[0] != 0)
+
+ if(info_element->data[0] != 0)
break;
-
+
if(info_element->data[2] & 1)
network->dtim_data |= IEEE80211_DTIM_MBCAST;
-
+
offset = (info_element->data[2] >> 1)*2;
-
- //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
-
- if(ieee->assoc_id < offset ||
+
+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
+
+ if(ieee->assoc_id < offset ||
ieee->assoc_id > 8*(offset + info_element->len -3))
-
+
break;
-
-
+
+
offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ;
-
- // printk("offset:%x data:%x, ucast:%d\n", offset,
+
+ // printk("offset:%x data:%x, ucast:%d\n", offset,
// info_element->data[3+offset] ,
// info_element->data[3+offset] & (1<<(ieee->assoc_id%8)));
-
+
if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
network->dtim_data |= IEEE80211_DTIM_UCAST;
-
+
break;
-
+
case MFIE_TYPE_IBSS_SET:
IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n");
break;
@@ -1115,7 +1190,7 @@
memcpy(network->rsn_ie, info_element,
network->rsn_ie_len);
break;
-
+
default:
IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
info_element->id);
@@ -1147,7 +1222,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,24 +1230,24 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
- * and the capability field (in particular IBSS and BSS) all match.
+ * and the capability field (in particular IBSS and BSS) all match.
* We treat all <hidden> with the same BSSID and channel
* as one network */
return ((src->ssid_len == dst->ssid_len) &&
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
- ((src->capability & WLAN_CAPABILITY_IBSS) ==
+ ((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
- ((src->capability & WLAN_CAPABILITY_BSS) ==
+ ((src->capability & WLAN_CAPABILITY_BSS) ==
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1194,7 +1269,7 @@
dst->dtim_data = src->dtim_data;
dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
-
+
memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len);
dst->wpa_ie_len = src->wpa_ie_len;
memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
@@ -1204,7 +1279,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1314,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1261,12 +1336,12 @@
* already there. */
spin_lock_irqsave(&ieee->lock, flags);
-
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
-
+
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
+
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1381,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1315,39 +1390,39 @@
WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
-
+
/* we have an entry and we are going to update it. But this entry may
- * be already expired. In this case we do the same as we found a new
+ * be already expired. In this case we do the same as we found a new
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_BEACON:
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
-
+
case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1430,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c 2008-01-30 17:38:11.000000000 +0100
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,211 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
+ if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE);
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,166 +882,181 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1067,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1092,19 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
- printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+ printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10));
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1087,44 +1112,45 @@
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1158,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1218,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1311,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1338,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1477,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1488,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1631,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1656,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1670,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1687,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1717,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1739,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1767,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1790,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
{
-
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1887,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1918,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
- ieee->rate = 540;
+
+// ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
- ieee->rate = 110;
+// ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1963,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1973,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2025,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
+
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2149,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2181,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2258,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2279,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2291,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2315,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2348,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2399,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2416,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2455,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2469,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2490,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2573,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2585,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2600,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2629,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2645,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c 2008-01-30 17:38:11.000000000 +0100
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c 2008-01-30 17:38:11.000000000 +0100
@@ -24,15 +24,14 @@
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -299,27 +304,27 @@
}
if(likely(ieee->raw_tx == 0)){
-
+
if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
-
+
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-
+
crypt = ieee->crypt[ieee->tx_keyidx];
-
+
encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
ieee->host_encrypt && crypt && crypt->ops;
-
+
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
stats->tx_dropped++;
goto success;
}
-
+
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !encrypt && ether_type == ETH_P_PAE) {
struct eapol *eap = (struct eapol *)(skb->data +
@@ -328,23 +333,23 @@
eap_get_type(eap->type));
}
#endif
-
+
/* Save source and destination addresses */
memcpy(&dest, skb->data, ETH_ALEN);
memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
-
+
/* Advance the SKB to the start of the payload */
skb_pull(skb, sizeof(struct ethhdr));
-
+
/* Determine total amount of storage required for TXB packets */
bytes = skb->len + SNAP_SIZE + sizeof(u16);
-
+
if (encrypt)
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_WEP;
else
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
-
+
if (ieee->iw_mode == IW_MODE_INFRA) {
fc |= IEEE80211_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -360,9 +365,9 @@
memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
}
header.frame_ctl = cpu_to_le16(fc);
-
+
hdr_len = IEEE80211_3ADDR_LEN;
-
+
/* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */
if (is_multicast_ether_addr(dest) ||
@@ -370,7 +375,7 @@
frag_size = MAX_FRAG_THRESHOLD;
else
frag_size = ieee->fts;
-
+
/* Determine amount of payload per fragment. Regardless of if
* this stack is providing the full 802.11 header, one will
* eventually be affixed to this fragment -- so we must account for
@@ -379,12 +384,12 @@
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
bytes_per_frag -= IEEE80211_FCS_LEN;
-
+
/* Each fragment may need to have room for encryptiong pre/postfix */
if (encrypt)
bytes_per_frag -= crypt->ops->extra_prefix_len +
crypt->ops->extra_postfix_len;
-
+
/* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */
nr_frags = bytes / bytes_per_frag;
@@ -393,11 +398,11 @@
nr_frags++;
else
bytes_last_frag = bytes_per_frag;
-
+
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -405,93 +410,94 @@
}
txb->encrypted = encrypt;
txb->payload_size = bytes;
-
+
for (i = 0; i < nr_frags; i++) {
skb_frag = txb->fragments[i];
-
+
if (encrypt)
skb_reserve(skb_frag, crypt->ops->extra_prefix_len);
-
+
frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len);
memcpy(frag_hdr, &header, hdr_len);
-
+
/* If this is not the last fragment, then add the MOREFRAGS
* bit to the frame control */
if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16(
fc | IEEE80211_FCTL_MOREFRAGS);
bytes = bytes_per_frag;
-
+
} else {
/* The last fragment takes the remaining length */
bytes = bytes_last_frag;
}
-
+
frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i);
-
-
+
+
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
}
-
+
memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
-
+
/* Advance the SKB... */
skb_pull(skb, bytes);
-
+
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
}
- // Advance sequence number in data frame.
+ // Advance sequence number in data frame.
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
- }
+ }
success:
spin_unlock_irqrestore(&ieee->lock, flags);
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
-
-
+
+
}
return 0;
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c 2008-01-30 17:38:11.000000000 +0100
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -259,6 +260,9 @@
int i, key, key_provided, len;
struct ieee80211_crypt_data **crypt;
+ if (erq->flags & IW_ENCODE_RESTRICTED)
+ return -EINVAL;
+
IEEE80211_DEBUG_WX("SET_ENCODE\n");
key = erq->flags & IW_ENCODE_INDEX;
@@ -281,7 +285,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +295,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +318,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +330,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +344,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +422,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +434,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +474,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile 2008-01-30 17:38:11.000000000 +0100
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_linux_26.1010.0622.2006/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/Makefile
--- rtl8187_linux_26.1010.0622.2006/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_linux_26.1010.0622.2006_rawtx/Makefile 2008-01-30 17:39:29.000000000 +0100
@@ -0,0 +1,38 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_linux_26.1010.0622.2006/symvers rtl8187_linux_26.1010.0622.2006_rawtx/symvers
--- rtl8187_linux_26.1010.0622.2006/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_linux_26.1010.0622.2006_rawtx/symvers 2008-01-30 17:38:11.000000000 +0100
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_linux_26.1010.0622.2006/wlan0rmv rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv
--- rtl8187_linux_26.1010.0622.2006/wlan0rmv 2006-09-05 07:21:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv 2008-01-30 17:38:11.000000000 +0100
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmod rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
Patch | aircrack-ng/patches/old/rtl8187_2.6.24v2.patch | diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h 2008-01-30 17:38:10.000000000 +0100
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h 2008-01-30 17:38:10.000000000 +0100
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile
--- rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile 2008-01-30 17:38:10.000000000 +0100
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c 2008-01-30 17:38:10.000000000 +0100
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h 2008-01-30 17:38:11.000000000 +0100
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c 2008-01-30 17:38:11.000000000 +0100
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h 2008-01-30 17:38:11.000000000 +0100
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c 2008-02-15 00:49:20.000000000 +0100
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 1
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,48 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
- max_cck_power_level = 15;
+
+
+ max_cck_power_level = 35;
//min_cck_power_level = 0;
- max_ofdm_power_level = 25; // 12 -> 25
+ max_ofdm_power_level = 35; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+ if(cck_power_level >= 20 && cck_power_level < 30)
+ cck_power_level = 19;
+
for(i=0;i<8;i++){
-
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +482,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +511,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +557,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +626,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +681,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +711,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +741,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +772,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +799,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +824,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +852,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +902,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +915,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x86); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +980,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1007,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1024,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c 2008-02-15 00:40:10.000000000 +0100
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,186 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > 35)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+// if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+// if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +265,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +298,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +322,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +346,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +365,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +417,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +448,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +456,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +476,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +526,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +564,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +582,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +612,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +650,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +702,49 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +757,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c 2008-02-15 00:37:05.000000000 +0100
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,35 +414,44 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
+#else
+ rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net);
+#endif
}
void rtl8180_proc_module_remove(void)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
+#else
+ remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net);
+#endif
}
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +468,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +480,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +489,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +508,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +544,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +560,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +582,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +604,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +623,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +637,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +659,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +779,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +823,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +848,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +886,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +913,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +930,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +955,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +967,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +980,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +996,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +1006,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1022,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1046,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1078,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1129,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1142,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1156,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1177,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1209,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1224,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1239,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1248,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1256,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1304,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1323,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1381,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1392,20 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1417,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1430,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1443,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1485,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1502,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1601,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1612,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1633,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1660,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1687,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1728,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1775,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1835,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1883,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1892,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1975,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2010,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2039,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2059,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2083,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2129,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2195,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2218,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2232,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2276,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2415,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2433,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2453,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2464,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2477,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2587,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2606,22 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+#endif
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2630,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2678,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2695,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2712,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2725,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2740,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ 2006-06-22 07:40:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,2527 +0,0 @@
-/*
- This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
- Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
- from Patric Schenke & Andres Salomon.
-
- Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
- some ideas might be derived from David Young rtl8180 netbsd driver.
-
- Parts of the usb code are from the r8150.c driver in linux kernel
-
- Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
- Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
-
- - Please note that this file is a modified version from rtl8180-sa2400
- drv. So some other people have contributed to this project, and they are
- thanked in the rtl8180-sa2400 CHANGELOG.
-*/
-
-#ifndef CONFIG_FORCE_HARD_FLOAT
-double __floatsidf (int i) { return i; }
-unsigned int __fixunsdfsi (double d) { return d; }
-double __adddf3(double a, double b) { return a+b; }
-double __addsf3(float a, float b) { return a+b; }
-double __subdf3(double a, double b) { return a-b; }
-double __extendsfdf2(float a) {return a;}
-#endif
-
-#undef LOOP_TEST
-#undef DUMP_RX
-#undef DUMP_TX
-#undef DEBUG_TX_DESC2
-#undef RX_DONT_PASS_UL
-#undef DEBUG_EPROM
-#undef DEBUG_RX_VERBOSE
-#undef DUMMY_RX
-#undef DEBUG_ZERO_RX
-#undef DEBUG_RX_SKB
-#undef DEBUG_TX_FRAG
-#undef DEBUG_RX_FRAG
-#undef DEBUG_TX_FILLDESC
-#undef DEBUG_TX
-#undef DEBUG_IRQ
-#undef DEBUG_RX
-#undef DEBUG_RXALLOC
-#undef DEBUG_REGISTERS
-#undef DEBUG_RING
-#undef DEBUG_IRQ_TASKLET
-#undef DEBUG_TX_ALLOC
-#undef DEBUG_TX_DESC
-
-//#define CONFIG_RTL8180_IO_MAP
-
-#include "r8180_hw.h"
-#include "r8187.h"
-#include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
-#include "r8180_93cx6.h" /* Card EEPROM */
-#include "r8180_wx.h"
-
-
-// FIXME: check if 2.6.7 is ok
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
-#define usb_kill_urb usb_unlink_urb
-#endif
-
-#ifdef CONFIG_RTL8180_PM
-#include "r8180_pm.h"
-#endif
-
-#ifndef USB_VENDOR_ID_REALTEK
-#define USB_VENDOR_ID_REALTEK 0x0bda
-#endif
-#ifndef USB_VENDOR_ID_NETGEAR
-#define USB_VENDOR_ID_NETGEAR 0x0846
-#endif
-
-static struct usb_device_id rtl8187_usb_id_tbl[] = {
- {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)},
- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)},
- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6a00)},
-
- {}
-};
-
-static char* ifname = "wlan%d";
-#if 0
-static int hwseqnum = 0;
-static int hwwep = 0;
-#endif
-static int channels = 0x3fff;
-
-MODULE_LICENSE("GPL");
-MODULE_VERSION("V 1.1");
-MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
-MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
-MODULE_DESCRIPTION("Linux driver for Realtek RTL8187 WiFi cards");
-
-#if 0
-MODULE_PARM(ifname,"s");
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-
-MODULE_PARM(hwseqnum,"i");
-MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-
-MODULE_PARM(hwwep,"i");
-MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-
-MODULE_PARM(channels,"i");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
-module_param(ifname, charp, S_IRUGO|S_IWUSR );
-//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
-//module_param(hwwep,int, S_IRUGO|S_IWUSR);
-module_param(channels,int, S_IRUGO|S_IWUSR);
-#else
-MODULE_PARM(ifname, "s");
-//MODULE_PARM(hwseqnum,"i");
-//MODULE_PARM(hwwep,"i");
-MODULE_PARM(channels,"i");
-#endif
-
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-//MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-
-static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id);
-
-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
-
-static struct usb_driver rtl8187_usb_driver = {
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
- .owner = THIS_MODULE,
-#endif
- .name = RTL8187_MODULE_NAME, /* Driver name */
- .id_table = rtl8187_usb_id_tbl, /* PCI_ID table */
- .probe = rtl8187_usb_probe, /* probe fn */
- .disconnect = rtl8187_usb_disconnect, /* remove fn */
-#ifdef CONFIG_RTL8180_PM
- .suspend = rtl8180_suspend, /* PM suspend fn */
- .resume = rtl8180_resume, /* PM resume fn */
-#else
- .suspend = NULL, /* PM suspend fn */
- .resume = NULL, /* PM resume fn */
-#endif
-};
-
-
-void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xfe00, 0, &data, 1, HZ / 2);
-}
-
-
-void write_nic_byte(struct net_device *dev, int indx, u8 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 1, HZ / 2);
-}
-
-
-void write_nic_word(struct net_device *dev, int indx, u16 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 2, HZ / 2);
-}
-
-
-void write_nic_dword(struct net_device *dev, int indx, u32 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 4, HZ / 2);
-}
-
-
-
-u8 read_nic_byte(struct net_device *dev, int indx)
-{
- u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 1, HZ / 2);
- return data;
-}
-
-u8 read_nic_byte_E(struct net_device *dev, int indx)
-{
- u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xfe00, 0, &data, 1, HZ / 2);
- return data;
-}
-
-
-u16 read_nic_word(struct net_device *dev, int indx)
-{
- u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 2, HZ / 2);
- return data;
-}
-
-
-u32 read_nic_dword(struct net_device *dev, int indx)
-{
- u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 4, HZ / 2);
- return data;
-}
-
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
- * plans are to possibilty turn it again in one common code...
- */
-inline void force_pci_posting(struct net_device *dev)
-{
-}
-
-
-//irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs);
-//void set_nic_rxring(struct net_device *dev);
-//void set_nic_txring(struct net_device *dev);
-static struct net_device_stats *rtl8180_stats(struct net_device *dev);
-void rtl8180_commit(struct net_device *dev);
-void rtl8180_restart(struct net_device *dev);
-
-/****************************************************************************
- -----------------------------PROCFS STUFF-------------------------
-*****************************************************************************/
-
-static struct proc_dir_entry *rtl8180_proc = NULL;
-
-static int proc_get_registers(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
- int i,n;
-
- int max=0xff;
-
- /* This dump the current register page */
- for(n=0;n<=max;)
- {
- //printk( "\nD: %2x> ", n);
- len += snprintf(page + len, count - len,
- "\nD: %2x > ",n);
-
- for(i=0;i<16 && n<=max;i++,n++)
- len += snprintf(page + len, count - len,
- "%2x ",read_nic_byte(dev,n));
-
- // printk("%2x ",read_nic_byte(dev,n));
- }
- len += snprintf(page + len, count - len,"\n");
-
-
-
- *eof = 1;
- return len;
-
-}
-
-#if 0
-static int proc_get_stats_hw(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "NIC int: %lu\n"
- "Total int: %lu\n",
- priv->stats.ints,
- priv->stats.shints);
-
- *eof = 1;
- return len;
-}
-#endif
-
-static int proc_get_stats_tx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "TX normal priority ok int: %lu\n"
- "TX normal priority error int: %lu\n"
-// "TX high priority ok int: %lu\n"
-// "TX high priority failed error int: %lu\n"
- "TX low priority ok int: %lu\n"
- "TX low priority failed error int: %lu\n"
- "TX queue resume: %lu\n"
- "TX queue stopped?: %d\n"
- "TX fifo overflow: %lu\n"
-// "TX beacon: %lu\n"
- "TX lp queue: %d\n"
- "TX np queue: %d\n"
- "TX HW queue: %d\n"
- "TX lp dropped: %lu\n"
- "TX np dropped: %lu\n"
- "TX total data packets %lu\n",
-// "TX beacon aborted: %lu\n",
- priv->stats.txnpokint,
- priv->stats.txnperr,
-// priv->stats.txhpokint,
-// priv->stats.txhperr,
- priv->stats.txlpokint,
- priv->stats.txlperr,
- priv->stats.txresumed,
- netif_queue_stopped(dev),
- priv->stats.txoverflow,
-// priv->stats.txbeacon,
- atomic_read(&(priv->tx_lp_pending)),
- atomic_read(&(priv->tx_np_pending)),
- read_nic_byte(dev, TXFIFOCOUNT),
- priv->stats.txlpdrop,
- priv->stats.txnpdrop,
- priv->stats.txdatapkt
-// priv->stats.txbeaconerr
- );
-
- *eof = 1;
- return len;
-}
-
-
-
-static int proc_get_stats_rx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "RX packets: %lu\n"
- "RX urb status error: %lu\n"
- "RX invalid urb error: %lu\n",
- priv->stats.rxok,
- priv->stats.rxstaterr,
- priv->stats.rxurberr);
-
- *eof = 1;
- return len;
-}
-
-
-static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return &priv->wstats;
-}
-
-void rtl8180_proc_module_init(void)
-{
- DMESG("Initializing proc filesystem");
- rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
-}
-
-
-void rtl8180_proc_module_remove(void)
-{
- remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
-}
-
-
-void rtl8180_proc_remove_one(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- if (priv->dir_dev) {
- // remove_proc_entry("stats-hw", priv->dir_dev);
- remove_proc_entry("stats-tx", priv->dir_dev);
- remove_proc_entry("stats-rx", priv->dir_dev);
- // remove_proc_entry("stats-ieee", priv->dir_dev);
- // remove_proc_entry("stats-ap", priv->dir_dev);
- remove_proc_entry("registers", priv->dir_dev);
- remove_proc_entry(dev->name, rtl8180_proc);
- priv->dir_dev = NULL;
- }
-}
-
-
-void rtl8180_proc_init_one(struct net_device *dev)
-{
- struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
- rtl8180_proc);
- if (!priv->dir_dev) {
- DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
- dev->name);
- return;
- }
- #if 0
- e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_hw, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-hw\n",
- dev->name);
- }
- #endif
- e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_rx, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-rx\n",
- dev->name);
- }
-
-
- e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_tx, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-tx\n",
- dev->name);
- }
- #if 0
- e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ieee, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-ieee\n",
- dev->name);
- }
-
-
- e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ap, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-ap\n",
- dev->name);
- }
- #endif
-
- e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_registers, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/registers\n",
- dev->name);
- }
-}
-/****************************************************************************
- -----------------------------MISC STUFF-------------------------
-*****************************************************************************/
-
-/* this is only for debugging */
-void print_buffer(u32 *buffer, int len)
-{
- int i;
- u8 *buf =(u8*)buffer;
-
- printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
- for(i=0;i<len;i++)
- printk("%c",buf[i]);
-
- printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
- for(i=0;i<len;i++)
- printk("%x",buf[i]);
-
- printk("\n");
-}
-
-short check_nic_enought_desc(struct net_device *dev, priority_t priority)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
- &priv->tx_np_pending : &priv->tx_lp_pending);
-
- return (used < MAX_TX_URB);
-}
-
-void tx_timeout(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- //rtl8180_commit(dev);
- schedule_work(&priv->reset_wq);
- //DMESG("TXTIMEOUT");
-}
-
-
-/* this is only for debug */
-void dump_eprom(struct net_device *dev)
-{
- int i;
- for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
-}
-
-/* this is only for debug */
-void rtl8180_dump_reg(struct net_device *dev)
-{
- int i;
- int n;
- int max=0xff;
-
- DMESG("Dumping NIC register map");
-
- for(n=0;n<=max;)
- {
- printk( "\nD: %2x> ", n);
- for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
- }
- printk("\n");
-}
-
-/****************************************************************************
- ------------------------------HW STUFF---------------------------
-*****************************************************************************/
-
-
-void rtl8180_irq_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- //priv->irq_enabled = 1;
-/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
- INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
- INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
-*/
- write_nic_word(dev,INTA_MASK, priv->irq_mask);
-}
-
-
-void rtl8180_irq_disable(struct net_device *dev)
-{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- write_nic_word(dev,INTA_MASK,0);
- force_pci_posting(dev);
-// priv->irq_enabled = 0;
-}
-
-
-void rtl8180_set_mode(struct net_device *dev,int mode)
-{
- u8 ecmd;
- ecmd=read_nic_byte(dev, EPROM_CMD);
- ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK;
- ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT);
- ecmd=ecmd &~ (1<<EPROM_CS_SHIFT);
- ecmd=ecmd &~ (1<<EPROM_CK_SHIFT);
- write_nic_byte(dev, EPROM_CMD, ecmd);
-}
-
-
-void rtl8180_update_msr(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- u8 msr;
-
- msr = read_nic_byte(dev, MSR);
- msr &= ~ MSR_LINK_MASK;
-
- /* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
- * this is intentional and make sense for ad-hoc and
- * master (see the create BSS/IBSS func)
- */
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
- if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
- msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
- else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
- msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
- else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
- msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
- }else
- msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
- write_nic_byte(dev, MSR, msr);
-}
-
-void rtl8180_set_chan(struct net_device *dev,short ch)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u32 tx;
- priv->chan=ch;
- #if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
- priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
- priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
- }
- #endif
-
- /* this hack should avoid frame TX during channel setting*/
- tx = read_nic_dword(dev,TX_CONF);
- tx &= ~TX_LOOPBACK_MASK;
-
-#ifndef LOOP_TEST
- write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
- priv->rf_set_chan(dev,priv->chan);
- mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
-#endif
-}
-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
-
-
-void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- int err;
-
-// u8 *rx;
-
- //DMESG("starting RX");
- /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
- DMESGE("unable to allocate RX buffer");
- return;
- }*/
-
- usb_fill_bulk_urb(rx_urb,priv->udev,
- usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
- RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
- if(err && err != -EPERM){
- DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
- }
-
-}
-
-
-void rtl8187_rx_initiate(struct net_device *dev)
-{
- int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- if(!priv->rx_urb)
- DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
- rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
-}
-
-void rtl8187_set_rxconf(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u32 rxconf;
-
- rxconf=read_nic_dword(dev,RX_CONF);
- rxconf = rxconf &~ MAC_FILTER_MASK;
- rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
-
- if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
- dev->flags & IFF_PROMISC){
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- }else{
- rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
- }
-
- /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
- }*/
-
- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
- rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
- }
-
- if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
- rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
- rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
- rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
- rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
- rxconf = rxconf &~ MAX_RX_DMA_MASK;
- rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
- rxconf = rxconf | RCR_ONLYERLPKT;
-
-// rxconf = rxconf &~ RCR_CS_MASK;
-// rxconf = rxconf | (1<<RCR_CS_SHIFT);
-
- write_nic_dword(dev, RX_CONF, rxconf);
-
- // V rtl suggested V //
-// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
- //fix_rx_fifo(dev);
-// //set_nic_rxring(dev);
- #ifdef DEBUG_RX
- DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF));
- #endif
-}
-
-void rtl8180_rx_enable(struct net_device *dev)
-{
- u8 cmd;
-
-
- rtl8187_rx_initiate(dev);
-
- rtl8187_set_rxconf(dev);
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
-#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
- */
- //mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
-#endif
-
-}
-
-
-void rtl8180_tx_enable(struct net_device *dev)
-{
- u8 cmd;
- u8 byte;
- u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- byte = read_nic_byte(dev,CW_CONF);
- byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
- byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
- write_nic_byte(dev, CW_CONF, byte);
-
- byte = read_nic_byte(dev, TX_AGC_CTL);
- byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
- byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
- byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
- write_nic_byte(dev, TX_AGC_CTL, byte);
-
- txconf= read_nic_dword(dev,TX_CONF);
-
- #if 0
- if(priv->card_8185){
-
- txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
- }else{
-
- if(priv->ieee80211->hw_seq)
- txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
- txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- }
- #endif
-
- txconf = txconf &~ TX_LOOPBACK_MASK;
-
-#ifndef LOOP_TEST
- txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
-#else
- txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
-#endif
- txconf = txconf &~ TCR_DPRETRY_MASK;
- txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
- txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
- txconf = txconf &~ TCR_MXDMA_MASK;
- txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
- txconf = txconf | TCR_CWMIN;
- txconf = txconf | TCR_DISCW;
- txconf = txconf &~ TCR_SWPLCPLEN;
-
- txconf=txconf | (1<<TX_NOICV_SHIFT);
-
- write_nic_dword(dev,TX_CONF,txconf);
-
- // V RTL suggested V //
-// write_nic_dword(dev,TX_CONF,0x00e00707);
-
-
-#ifdef DEBUG_TX
- DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
-#endif
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
-
-// mdelay(100);
- //write_nic_dword(dev,TX_CONF,txconf);
-// #endif
-/*
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev, TX_DMA_POLLING, priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- */
-}
-
-#if 0
-void rtl8180_beacon_tx_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-
-
-void rtl8180_
-_disable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-
-#endif
-
-
-void rtl8180_rtx_disable(struct net_device *dev)
-{
- u8 cmd;
- int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev, CMD, cmd &~ \
- ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
- force_pci_posting(dev);
- mdelay(10);
- if(priv->rx_urb){
- for(i=0;i<MAX_RX_URB;i++)
- usb_kill_urb(priv->rx_urb[i]);
- }
- /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
- */
-
-// if(!priv->rx_skb_complete)
-// dev_kfree_skb_any(priv->rx_skb);
-}
-
-
-int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
-{
- #if 0
- int i;
- u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
- &priv->txbeaconringdma);
- if (!priv->txbeaconring) return -1;
- for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
- /*
- *(tmp+2) = (u32)dma_tmp;
- *(tmp+3) = bufsize;
- */
- if(i+1<count)
- *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
- else
- *(tmp+4) = (u32)priv->txbeaconringdma;
-
- tmp=tmp+8;
- }
- #endif
- return 0;
-}
-
-
-void rtl8180_reset(struct net_device *dev)
-{
-
- u8 cr;
-
- /* make sure the analog power is on before
- * reset, otherwise reset may fail
- */
- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
- rtl8180_irq_disable(dev);
-
- mdelay(200);
- write_nic_byte_E(dev,0x18,0x10);
- write_nic_byte_E(dev,0x18,0x11);
- write_nic_byte_E(dev,0x18,0x00);
- mdelay(200);
-
- cr=read_nic_byte(dev,CMD);
- cr = cr & 2;
- cr = cr | (1<<CMD_RST_SHIFT);
- write_nic_byte(dev,CMD,cr);
-
- force_pci_posting(dev);
-
- mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
- DMESGW("Card reset timeout!");
- else
- DMESG("Card successfully reset");
-
- rtl8180_set_mode(dev,EPROM_CMD_LOAD);
- force_pci_posting(dev);
- mdelay(200);
-
- /* after the eeprom load cycle, make sure we have
- * correct anaparams
- */
- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
-}
-
-inline u16 ieeerate2rtlrate(int rate)
-{
- switch(rate){
- case 10:
- return 0;
- case 20:
- return 1;
- case 55:
- return 2;
- case 110:
- return 3;
- case 60:
- return 4;
- case 90:
- return 5;
- case 120:
- return 6;
- case 180:
- return 7;
- case 240:
- return 8;
- case 360:
- return 9;
- case 480:
- return 10;
- case 540:
- return 11;
- default:
- return 3;
-
- }
-}
-static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
-inline u16 rtl8180_rate2rate(short rate)
-{
- if (rate >11) return 0;
- return rtl_rate[rate];
-}
-
-
-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- priv->rxurb_task = rx_urb;
-// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
-// DMESGW("=David: Rx tasklet finish!");
-}
-
-#if 0
-void rtl8180_tx_queues_stop(struct net_device *dev)
-{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
-
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-#endif
-
-void rtl8180_data_hard_stop(struct net_device *dev)
-{
- //FIXME !!
- #if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- #endif
-}
-
-
-void rtl8180_data_hard_resume(struct net_device *dev)
-{
- // FIXME !!
- #if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- #endif
-}
-
-
-/* this function TX data frames when the ieee80211 stack requires this.
- * It checks also if we need to stop the ieee tx queue, eventually do it
- */
-void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
- unsigned long flags;
- struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
-
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
-// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
- /*
- * This function doesn't require lock because we make
- * sure it's called with the tx_lock already acquired.
- * this come from the kernel's hard_xmit callback (trought
- * the ieee stack, or from the try_wake_queue (again trought
- * the ieee stack.
- */
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
-}
-#if 0
-/* This is a rough attempt to TX a frame
- * This is called by the ieee 80211 stack to TX management frames.
- * If the ring is full packet are dropped (for data frame the queue
- * is stopped before this can happen).
- */
-int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- int ret;
- unsigned long flags;
-
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
-/*
- int i;
- for(i=0;i<skb->len;i++)
- printk("%x ", skb->data[i]);
- printk("--------------------\n");
-*/
- priv->ieee80211->stats.tx_bytes+=skb->len;
- priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
- dev_kfree_skb_any(skb);
- return ret;
-}
-#endif
-
-#if 0
-// longpre 144+48 shortpre 72+24
-u16 rtl8180_len2duration(u32 len, short rate,short* ext)
-{
- u16 duration;
- u16 drift;
- *ext=0;
-
- switch(rate){
- case 0://1mbps
- *ext=0;
- duration = ((len+4)<<4) /0x2;
- drift = ((len+4)<<4) % 0x2;
- if(drift ==0 ) break;
- duration++;
- break;
-
- case 1://2mbps
- *ext=0;
- duration = ((len+4)<<4) /0x4;
- drift = ((len+4)<<4) % 0x4;
- if(drift ==0 ) break;
- duration++;
- break;
-
- case 2: //5.5mbps
- *ext=0;
- duration = ((len+4)<<4) /0xb;
- drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
- break;
- duration++;
- break;
-
- default:
- case 3://11mbps
- *ext=0;
- duration = ((len+4)<<4) /0x16;
- drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
- break;
- duration++;
- if(drift > 6)
- break;
- *ext=1;
- break;
- }
-
- return duration;
-}
-#endif
-
-void rtl8180_try_wake_queue(struct net_device *dev, int pri);
-
-void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(tx_urb->status == 0)
- priv->stats.txlpokint++;
- else
- priv->stats.txlperr++;
- kfree(tx_urb->transfer_buffer);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_lp_pending);
- rtl8180_try_wake_queue(dev,LOW_PRIORITY);
-}
-
-
-void rtl8187_beacon_stop(struct net_device *dev)
-{
- u8 msr, msrm, msr2;
- msr = read_nic_byte(dev, MSR);
- msrm = msr & MSR_LINK_MASK;
- msr2 = msr & ~MSR_LINK_MASK;
- if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
- (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
- write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
- }
-
-
-}
-
-
-void rtl8187_net_update(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct ieee80211_network *net;
- net = & priv->ieee80211->current_network;
-
-
- write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
- write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
- //for(i=0;i<ETH_ALEN;i++)
- // write_nic_byte(dev,BSSID+i,net->bssid[i]);
-
- rtl8180_update_msr(dev);
-
-// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
- write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
- write_nic_word(dev, BcnIntTime, 100);
-
-
-}
-
-void rtl8187_beacon_tx(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct sk_buff *skb;
- int i = 0;
-
- rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
- DMESG("not enought memory for allocating beacon");
- return;
- }
-
-#if 0
- while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
- msleep_interruptible_rtl(HZ/2);
- if(i++ > 20){
- DMESG("get stuck to wait EP3 become ready");
- return ;
- }
- }
-#endif
- write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
- i=0;
- //while(!read_nic_byte(dev,BQREQ & (1<<7)))
- while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
- {
- msleep_interruptible_rtl(HZ/2);
- if(i++ > 10){
- DMESG("get stuck to wait HW beacon to be ready");
- return ;
- }
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
- 0, priv->ieee80211->basic_rate);
-
-}
-
-void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(tx_urb->status == 0)
- priv->stats.txnpokint++;
- else
- priv->stats.txnperr++;
- kfree(tx_urb->transfer_buffer);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_np_pending);
- //rtl8180_try_wake_queue(dev,NORM_PRIORITY);
-}
-
-
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
- */
-
-short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
- short morefrag, short rate)
-{
- u32 *tx;
-// u16 duration;
-// short ext;
- int pend ;
- int status;
- struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
-// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
-
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
- if( pend > MAX_TX_URB){
- if(priority == NORM_PRIORITY)
- priv->stats.txnpdrop++;
- else
- priv->stats.txlpdrop++;
- return -1;
- }
-
-
- //tx = kmalloc((len + 4*3), GFP_ATOMIC);
- urb_len = len + 4*3;
- if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
- }
- tx = kmalloc(urb_len, GFP_ATOMIC);
- if(!tx) return -ENOMEM;
-printk(KERN_WARNING "urb_len = %d\n", urb_len);
- tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
- if(!tx_urb){
-
- kfree(tx);
- return -ENOMEM;
- }
-
- memcpy(tx+3,txbuf,len);
- tx[0] = 0;
- tx[0] |= len & 0xfff;
- tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
- if(morefrag) tx[0] |= (1<<17);
- tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
- tx[0] |= (rate << 24);
- tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
-
-// tx[2] = 0x303020;
- tx[2] = 3; // CW min
- tx[2] |= (7<<4); //CW max
- tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
-// printk("%x\n%x\n",tx[0],tx[1]);
-
- #ifdef DUMP_TX
- int i;
- printk("<Tx pkt>--rate %x---",rate);
- for (i = 0; i < (len + 3); i++)
- printk("%2x", ((u8*)tx)[i]);
- printk("---------------\n");
- #endif
-
-
- /* FIXME check what EP is for low/norm PRI */
- usb_fill_bulk_urb(tx_urb,priv->udev,
- usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
- urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev);
- status = usb_submit_urb(tx_urb, GFP_ATOMIC);
- if (!status){
- atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- return 0;
- }else{
- DMESGE("Error TX URB %d, error %d",
- atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
- status);
- return -1;
- }
-}
-
-
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
-
-
-short rtl8187_usb_initendpoints(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i;
-
- priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
- for(i=0;i<MAX_RX_URB;i++){
- priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
- goto destroy;
-
- priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
- goto destroy1;
-
- priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
- }
-
- return 0;
-
-destroy1:
- usb_free_urb(priv->rx_urb[i]);
-
-destroy:
- while (--i >= 0){
- kfree(priv->rx_urb[i]->transfer_buffer);
- usb_free_urb(priv->rx_urb[i]);
- }
-
- kfree(priv->rx_urb);
-
- priv->rx_urb = NULL;
- DMESGE("Endpoint Alloc Failure");
- return -ENOMEM;
-
-}
-
-void rtl8187_usb_deleteendpoints(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i;
-
- if(priv->rx_urb){
- for(i=0;i<MAX_RX_URB;i++){
- usb_kill_urb(priv->rx_urb[i]);
- kfree(priv->rx_urb[i]->transfer_buffer);
- usb_free_urb(priv->rx_urb[i]);
- }
- kfree(priv->rx_urb);
- priv->rx_urb = NULL;
-
- }
-
-}
-
-
-void rtl8187_set_rate(struct net_device *dev)
-{
- int i;
- u16 word;
- int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
-// priv->ieee80211->state == IEEE80211_LINKED){
- basic_rate = ieeerate2rtlrate(240);
- min_rr_rate = ieeerate2rtlrate(60);
- max_rr_rate = ieeerate2rtlrate(240);
-
-//
-// }else{
-// basic_rate = ieeerate2rtlrate(20);
-// min_rr_rate = ieeerate2rtlrate(10);
-// max_rr_rate = ieeerate2rtlrate(110);
-// }
-
- write_nic_byte(dev, RESP_RATE,
- max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT);
-
- word = read_nic_word(dev, BRSR);
- word &= ~BRSR_MBR_8185;
-
-
- for(i=0;i<=basic_rate;i++)
- word |= (1<<i);
-
- write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
-}
-
-
-void rtl8187_link_change(struct net_device *dev)
-{
-// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- //write_nic_word(dev, BintrItv, net->beacon_interval);
- rtl8187_net_update(dev);
- /*update timing params*/
- rtl8180_set_chan(dev, priv->chan);
-
- rtl8187_set_rxconf(dev);
-}
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv);
-
-short rtl8180_init(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i, j;
- u16 word;
- int ch;
- //u16 version;
- //u8 hw_version;
- //u8 config3;
-
- //FIXME: these constants are placed in a bad pleace.
-
-// priv->txbuffsize = 1024;
-// priv->txringcount = 32;
-// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
-// priv->txbeaconcount = 3;
-// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
- /* ^^ the SKB does not containt a partial RXed
- * packet (is empty)
- */
-
- if(!channels){
- DMESG("No channels, aborting");
- return -1;
- }
- ch=channels;
- // set channels 1..14 allowed in given locale
- for (i=1; i<=14; i++) {
- (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
- ch >>= 1;
- }
- //memcpy(priv->stats,0,sizeof(struct Stats));
-
- //priv->irq_enabled=0;
-
-// priv->stats.rxdmafail=0;
- priv->stats.txrdu=0;
-// priv->stats.rxrdu=0;
-// priv->stats.rxnolast=0;
-// priv->stats.rxnodata=0;
- //priv->stats.rxreset=0;
- //priv->stats.rxwrkaround=0;
-// priv->stats.rxnopointer=0;
- priv->stats.txnperr=0;
- priv->stats.txresumed=0;
-// priv->stats.rxerr=0;
-// priv->stats.rxoverflow=0;
-// priv->stats.rxint=0;
- priv->stats.txnpokint=0;
- /*priv->stats.txhpokint=0;
- priv->stats.txhperr=0;*/
- priv->stats.rxurberr=0;
- priv->stats.rxstaterr=0;
- priv->stats.txoverflow=0;
- priv->stats.rxok=0;
-// priv->stats.txbeaconerr=0;
- priv->stats.txlperr=0;
- priv->stats.txlpokint=0;
-
- priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
- priv->retry_rts = DEFAULT_RETRY_RTS;
- priv->retry_data = DEFAULT_RETRY_DATA;
- priv->ieee80211->rate = 110; //11 mbps
- priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
- priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
- spin_lock_init(&priv->tx_lock);
- INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
- sema_init(&priv->wx_sem,1);
- tasklet_init(&priv->irq_rx_tasklet,
- (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
- (unsigned long)priv);
-
- //priv->ieee80211->func =
- // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
- //memset(priv->ieee80211->func, 0,
- // sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
- priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
- IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
- /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
- priv->ieee80211->active_scan = 1;
- priv->ieee80211->rate = 110; //11 mbps
- priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
- priv->ieee80211->host_encrypt = 1;
- priv->ieee80211->host_decrypt = 1;
- priv->ieee80211->start_send_beacons = rtl8187_beacon_tx;
- priv->ieee80211->stop_send_beacons = rtl8187_beacon_stop;
- //priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit;
- priv->ieee80211->softmac_hard_start_xmit = NULL;
- priv->ieee80211->set_chan = rtl8180_set_chan;
- priv->ieee80211->link_change = rtl8187_link_change;
- priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit;
- priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop;
- priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
- //priv->ieee80211->start_send_beacons = NULL;
- //priv->ieee80211->stop_send_beacons = NULL;
-
- priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
- priv->card_8185 = 2;
- priv->phy_ver = 2;
- priv->card_type = USB;
-
- #if 0
- hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
- switch (hw_version){
- case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
- priv->card_8185 = 1;
- /* you should not find a card with 8225 PHY ver < C*/
- priv->phy_ver = 2;
- break;
-
- case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
- priv->card_8185 = 2;
- /* you should not find a card with 8225 PHY ver < C*/
- priv->phy_ver = 2;
- break;
-
- case HW_VERID_R8180_ABCD:
- DMESG("MAC controller is a RTL8180");
- priv->card_8185 = 0;
- break;
-
- case HW_VERID_R8180_F:
- DMESG("MAC controller is a RTL8180 (v. F)");
- priv->card_8185 = 0;
- break;
-
- default:
- DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
- priv->card_8185 = 0;
- break;
- }
-
-
- /* you should not found any 8185 Ver B Card */
- priv->card_8185_Bversion = 0;
-
- config3 = read_nic_byte(dev, CONFIG3);
- if(config3 & 0x8){
- priv->card_type = CARDBUS;
- DMESG("This is a CARDBUS NIC");
- }
- else if( config3 & 0x4){
- priv->card_type = MINIPCI;
- DMESG("This is a MINI-PCI NIC");
- }else{
- priv->card_type = PCI;
- DMESG("This is a PCI NIC");
- }
- #endif
- priv->enable_gpio0 = 0;
-
-
- /* commented out just because we already do
- this when resetting the card
- andrea 20050924
- */
- #if 0
-
- u8 txcr, txreg50;
- u32 txreg54, txreg60;
-
- /* enable A/D D/A register */
- txcr = read_nic_byte(dev, 0x59);
-// DMESG("<txcr:%x>", txcr);
- //write_nic_word(dev, 0x59, 0x44);
- write_nic_byte(dev, 0x59, 0x44);
- //write_nic_byte(dev, 0x59, 0xea);
- txcr = read_nic_byte(dev, 0x59);
-// DMESG("<<txcr:%x>>", txcr);
-
- txreg50 = read_nic_byte(dev, 0x50);
- // DMESG("<txreg50:%x>", txreg50);
- write_nic_byte(dev, 0x50, 0xc0);
- txreg50 = read_nic_byte(dev, 0x50);
- // DMESG("<<txreg50:%x>>", txreg50);
-
-
- txreg54 = read_nic_dword(dev, 0x54);
- // DMESG("<txreg54:%x>", txreg54);
- txreg54 = 0xa0000a59;
- // DMESG("<<txreg54:%x>>", txreg54);
- write_nic_dword(dev, 0x54, txreg54);
- txreg54 = read_nic_dword(dev, 0x54);
- // DMESG("<<<txreg54:%x>>>", txreg54);
-
- txreg60 = read_nic_dword(dev, 0x60);
- // DMESG("<txreg60:%x>", txreg60);
-
- write_nic_byte(dev, 0x50, 0x0);
- txcr = read_nic_byte(dev, 0x50);
- // DMESG("<<txcr:%x>>", txcr);
-
-#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
- if (RCR_9356SEL & read_nic_dword(dev, RCR)){
- priv->epromtype=EPROM_93c56;
- DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
- }else{
- priv->epromtype=EPROM_93c46;
- DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
- }
-
- dev->get_stats = rtl8180_stats;
-
- dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
- dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
- dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
- dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
- dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
- dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
- DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
- for(i=1,j=0; i<6; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW0 + j);
- priv->chtxpwr[i]=word & 0xf;
- priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
- priv->chtxpwr[i+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
- }
-
- for(i=1,j=0; i<4; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW1 + j);
- priv->chtxpwr[i+6]=word & 0xf;
- priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
- priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
- }
-
- for(i=1,j=0; i<4; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW2 + j);
- priv->chtxpwr[i+6+4]=word & 0xf;
- priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
- priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
- }
-
-
- priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
- word = eprom_read(dev,EPROM_TXPW_BASE);
- priv->cck_txpwr_base = word & 0xf;
- priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
- /* check RF frontend chipset */
-
- switch (priv->rf_chip) {
-
- case EPROM_RFCHIPID_RTL8225U:
-
- DMESG("Card reports RF frontend Realtek 8225");
- DMESGW("This driver has EXPERIMENTAL support for this chipset.");
- DMESGW("use it with care and at your own risk and");
- DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
- if(rtl8225_is_V_z2(dev)){
- priv->rf_init = rtl8225z2_rf_init;
- priv->rf_set_chan = rtl8225z2_rf_set_chan;
- priv->rf_set_sens = NULL;
- DMESG("This seems a new V2 radio");
- }else{
- priv->rf_init = rtl8225_rf_init;
- priv->rf_set_chan = rtl8225_rf_set_chan;
- priv->rf_set_sens = rtl8225_rf_set_sens;
- DMESG("This seems a legacy 1st version radio");
- }
- priv->rf_close = rtl8225_rf_close;
-
- priv->max_sens = RTL8225_RF_MAX_SENS;
- priv->sens = RTL8225_RF_DEF_SENS;
- break;
-
- default:
- DMESGW("Unknown RF module %x",priv->rf_chip);
- DMESGW("Exiting...");
- return -1;
-
- }
-
-// DMESG("Energy threshold: %x",priv->cs_treshold);
- DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
- //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
- DMESG("Endopoints initialization failed");
- return -ENOMEM;
- }
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_NORMPRIORITY_RING_ADDR))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_HIGHPRIORITY_RING_ADDR))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_LOWPRIORITY_RING_ADDR))
- return -ENOMEM;
-
-
- if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
- return -ENOMEM;
-#endif
-
-
-#ifdef DEBUG_EPROM
- dump_eprom(dev);
-#endif
- return 0;
-
-}
-
-void rtl8185_rf_pins_enable(struct net_device *dev)
-{
-/* u16 tmp;
- tmp = read_nic_word(dev, RFPinsEnable);*/
- write_nic_word(dev, RFPinsEnable, 0x1ff7);// | tmp);
-}
-
-
-void rtl8185_set_anaparam2(struct net_device *dev, u32 a)
-{
- u8 conf3;
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- write_nic_dword(dev, ANAPARAM2, a);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
-}
-
-
-void rtl8180_set_anaparam(struct net_device *dev, u32 a)
-{
- u8 conf3;
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- write_nic_dword(dev, ANAPARAM, a);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
-}
-
-
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
-{
- write_nic_byte(dev, TX_ANTENNA, ant);
- force_pci_posting(dev);
- mdelay(1);
-}
-
-
-void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
-{
- //u8 phyr;
- u32 phyw;
-// int i;
-
- adr |= 0x80;
-
- phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
- write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
- write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
- write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
- write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
-
- //read_nic_dword(dev, PHY_ADR);
-#if 0
- for(i=0;i<10;i++){
- write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
- phyr = read_nic_byte(dev, PHY_READ);
- if(phyr == (data&0xff)) break;
-
- }
-#endif
- /* this is ok to fail when we write AGC table. check for AGC table might be
- * done by masking with 0x7f instead of 0xff
- */
- //if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data, adr);
- mdelay(1);
-}
-
-
-inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data)
-{
- data = data & 0xff;
- rtl8187_write_phy(dev, adr, data);
-}
-
-
-void write_phy_cck (struct net_device *dev, u8 adr, u32 data)
-{
- data = data & 0xff;
- rtl8187_write_phy(dev, adr, data | 0x10000);
-}
-
-
-void rtl8180_adapter_start(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- //u32 anaparam;
- //u8 config3;
-
- //rtl8180_rtx_disable(dev);
- rtl8180_reset(dev);
-
- write_nic_byte(dev,0x85,0);
- write_nic_byte(dev,0x91,0);
-
- /* light blink! */
- write_nic_byte(dev,0x85,4);
- write_nic_byte(dev,0x91,1);
- write_nic_byte(dev,0x90,0);
-
- priv->irq_mask = 0xffff;
-/*
- priv->dma_poll_mask = 0;
- priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
-// rtl8180_beacon_tx_disable(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
- write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
- write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
- rtl8180_update_msr(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- write_nic_word(dev,0xf4,0xffff);
- write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
-
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
-
-#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
-#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
-
- write_nic_byte(dev, RATE_FALLBACK, 0x81);
- rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
-
- if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
- write_nic_word(dev,0x5e,1);
-
- #if 1
- //mdelay(1);
- write_nic_word(dev,0xfe,0x10);
-// mdelay(1);
- #endif
- write_nic_byte(dev, TALLY_SEL, 0x80);//Set NQ retry count
-
- write_nic_byte(dev, 0xff, 0x60);
-
- write_nic_word(dev,0x5e,0);
-
-
- rtl8180_irq_enable(dev);
- /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
- DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
- DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
- if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
- if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
- if(check_nic_enought_desc(dev,LOW_PRIORITY)) DMESG("LOW OK");*/
-}
-
-
-
-/* this configures registers for beacon tx and enables it via
- * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might
- * be used to stop beacon transmission
- */
-#if 0
-void rtl8180_start_tx_beacon(struct net_device *dev)
-{
- int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
- DMESG("Enabling beacon TX");
- //write_nic_byte(dev, 0x42,0xe6);// TCR
- //rtl8180_init_beacon(dev);
- //set_nic_txring(dev);
-// rtl8180_prepare_beacon(dev);
- rtl8180_irq_disable(dev);
-// rtl8180_beacon_tx_enable(dev);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- //write_nic_byte(dev,0x9d,0x20); //DMA Poll
- //write_nic_word(dev,0x7a,0);
- //write_nic_word(dev,0x7a,0x8000);
-
-
- word = read_nic_word(dev, BcnItv);
- word &= ~BcnItv_BcnItv; // clear Bcn_Itv
- write_nic_word(dev, BcnItv, word);
-
- write_nic_word(dev, AtimWnd,
- read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
- word = read_nic_word(dev, BintrItv);
- word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
- // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
- // FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
- write_nic_word(dev, BintrItv, word);
-
- //write_nic_word(dev,0x2e,0xe002);
- //write_nic_dword(dev,0x30,0xb8c7832e);
- for(i=0; i<ETH_ALEN; i++)
- write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
-// rtl8180_update_msr(dev);
-
-
- //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
- rtl8180_irq_enable(dev);
-
- /* VV !!!!!!!!!! VV*/
- /*
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-*/
-}
-#endif
-/***************************************************************************
- -------------------------------NET STUFF---------------------------
-***************************************************************************/
-static struct net_device_stats *rtl8180_stats(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return &priv->ieee80211->stats;
-}
-
-
-int _rtl8180_up(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- priv->up=1;
-
- //DMESG("Bringing up iface");
-
- rtl8180_adapter_start(dev);
-
- rtl8180_rx_enable(dev);
-
- rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
- if(!netif_queue_stopped(dev))
- netif_start_queue(dev);
- else
- netif_wake_queue(dev);
-
- return 0;
-}
-
-
-int rtl8180_open(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
- down(&priv->wx_sem);
- ret = rtl8180_up(dev);
- up(&priv->wx_sem);
- return ret;
-
-}
-
-
-int rtl8180_up(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 1) return -1;
-
- return _rtl8180_up(dev);
-}
-
-
-int rtl8180_close(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
- down(&priv->wx_sem);
-
- ret = rtl8180_down(dev);
-
- up(&priv->wx_sem);
-
- return ret;
-
-}
-
-int rtl8180_down(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 0) return -1;
-
- priv->up=0;
-
-/* FIXME */
- if (!netif_queue_stopped(dev))
- netif_stop_queue(dev);
-
- rtl8180_rtx_disable(dev);
- rtl8180_irq_disable(dev);
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
- return 0;
-}
-
-
-void rtl8180_commit(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
- rtl8180_irq_disable(dev);
- rtl8180_rtx_disable(dev);
- _rtl8180_up(dev);
-}
-
-void rtl8180_restart(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- down(&priv->wx_sem);
-
- rtl8180_commit(dev);
-
- up(&priv->wx_sem);
-}
-
-static void r8180_set_multicast(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- short promisc;
-
- //down(&priv->wx_sem);
-
- /* FIXME FIXME */
-
- promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
- if (promisc != priv->promisc)
- // rtl8180_commit(dev);
-
- priv->promisc = promisc;
-
- //schedule_work(&priv->reset_wq);
- //up(&priv->wx_sem);
-}
-
-
-int r8180_set_mac_adr(struct net_device *dev, void *mac)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct sockaddr *addr = mac;
-
- down(&priv->wx_sem);
-
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
- schedule_work(&priv->reset_wq);
-
- up(&priv->wx_sem);
-
- return 0;
-}
-
-
-/* based on ipw2200 driver */
-int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
- switch (cmd) {
- case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
- break;
-
- default:
- ret = -EOPNOTSUPP;
- break;
- }
-
- up(&priv->wx_sem);
-
- return ret;
-}
-
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv)
-{
- struct urb *rx_urb = priv->rxurb_task;
- struct net_device *dev = (struct net_device*)rx_urb->context;
- int status,len,flen;
- struct sk_buff *skb;
- u32 *desc;
-
- //DMESG("rtl8187_rx_isr");
-
- struct ieee80211_rx_stats stats = {
- .signal = 0,
- .noise = -98,
- .rate = 0,
- // .mac_time = jiffies,
- .freq = IEEE80211_24GHZ_BAND,
- };
-
- //DMESG("RX %d ",rx_urb->status);
- status = rx_urb->status;
- if(status == 0){
-
- len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
- len -= 4*4;/* 4 dword and 4 byte CRC */
-
- desc = (u32*)(rx_urb->transfer_buffer + len);
-
- flen = desc[0] & 0xfff;
-
- if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
- stats.mac_time[0] = desc[2];
- stats.mac_time[1] = desc[3];
- skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
- memcpy(skb_put(skb,flen-4),
- rx_urb->transfer_buffer,flen -4);
-
- #ifdef DUMP_RX
- int i;
- for(i=0;i<flen-4;i++)
- printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
- printk("------RATE %x:w---------------\n",stats.rate);
-
- #endif
- priv->stats.rxok++;
- // priv->rxskb = skb;
- // priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
- skb, &stats))
- dev_kfree_skb_any(skb);
- }
- }else priv->stats.rxurberr++;
- }else{
- priv->stats.rxstaterr++;
- priv->ieee80211->stats.rx_errors++;
-
- }
-
- if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
- else DMESG("RX process aborted due to explicit shutdown");
-}
-
-/****************************************************************************
- ---------------------------- USB_STUFF---------------------------
-*****************************************************************************/
-
-
-static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
-{
-// unsigned long ioaddr = 0;
- struct net_device *dev = NULL;
- struct r8180_priv *priv= NULL;
- struct usb_device *udev = interface_to_usbdev(intf);
-
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
- SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
- SET_NETDEV_DEV(dev, &intf->dev);
-
- priv = ieee80211_priv(dev);
- priv->ieee80211 = netdev_priv(dev);
-
- priv->udev=udev;
-
- dev->open = rtl8180_open;
- dev->stop = rtl8180_close;
- //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
- dev->tx_timeout = tx_timeout;
- dev->wireless_handlers = &r8180_wx_handlers_def;
- dev->do_ioctl = rtl8180_ioctl;
- dev->set_multicast_list = r8180_set_multicast;
- dev->set_mac_address = r8180_set_mac_adr;
- dev->get_wireless_stats = r8180_get_wireless_stats;
- dev->type=ARPHRD_ETHER;
-
- if (dev_alloc_name(dev, ifname) < 0){
- DMESG("Oops: devname already taken! Trying wlan%%d...\n");
- ifname = "wlan%d";
- dev_alloc_name(dev, ifname);
- }
-
-// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
- DMESG("Initialization failed");
- goto fail;
- }
-
- netif_carrier_off(dev);
- netif_stop_queue(dev);
-
- register_netdev(dev);
-
- rtl8180_proc_init_one(dev);
-
-
- DMESG("Driver probe completed\n");
- return 0;
-
-
-fail:
- free_ieee80211(dev);
-
- DMESG("wlan driver load failed\n");
-
- return -ENODEV;
-
-}
-
-
-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf)
-{
- struct r8180_priv *priv;
- struct net_device *dev = usb_get_intfdata(intf);
- if(dev){
-
- unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
- rtl8180_proc_remove_one(dev);
-
- rtl8180_down(dev);
- priv->rf_close(dev);
- //rtl8180_rtx_disable(dev);
- rtl8187_usb_deleteendpoints(dev);
- rtl8180_irq_disable(dev);
- rtl8180_reset(dev);
- mdelay(10);
-
- }
-// pci_disable_device(pdev);
- free_ieee80211(dev);
- DMESG("wlan driver removed\n");
-}
-
-
-static int __init rtl8187_usb_module_init(void)
-{
- printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
-based WLAN cards\n");
- printk(KERN_INFO "Copyright (c) 2004-2005, Andrea Merello\n");
- DMESG("Initializing module");
- DMESG("Wireless extensions version %d", WIRELESS_EXT);
- rtl8180_proc_module_init();
- return usb_register(&rtl8187_usb_driver);
-}
-
-
-static void __exit rtl8187_usb_module_exit(void)
-{
- usb_deregister(&rtl8187_usb_driver);
-
- rtl8180_proc_module_remove();
- DMESG("Exiting");
-}
-
-
-void rtl8180_try_wake_queue(struct net_device *dev, int pri)
-{
- unsigned long flags;
- short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- spin_lock_irqsave(&priv->tx_lock,flags);
- enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
- if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
-}
-
-
-
-/***************************************************************************
- ------------------- module init / exit stubs ----------------
-****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h 2008-01-30 17:38:11.000000000 +0100
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,17 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +167,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +180,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +234,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +248,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,288 +0,0 @@
-/*
- This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
- Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
- official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
- from Patric Schenke & Andres Salomon
-
- Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
- project Authors.
-*/
-
-#ifndef R8180H
-#define R8180H
-
-
-#define RTL8187_MODULE_NAME "rtl8187"
-#define DMESG(x,a...) printk(KERN_INFO RTL8187_MODULE_NAME ": " x "\n", ## a)
-#define DMESGW(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": WW:" x "\n", ## a)
-#define DMESGE(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": EE:" x "\n", ## a)
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/netdevice.h>
-//#include <linux/pci.h>
-#include <linux/usb.h>
-#include <linux/etherdevice.h>
-#include <linux/delay.h>
-#include <linux/rtnetlink.h> //for rtnl_lock()
-#include <linux/wireless.h>
-#include <linux/timer.h>
-#include <linux/proc_fs.h> // Necessary because we use the proc fs
-#include <linux/if_arp.h>
-#include <linux/random.h>
-#include <linux/version.h>
-#include <asm/io.h>
-#include <asm/semaphore.h>
-
-#include "ieee80211.h"
-
-#define EPROM_93c46 0
-#define EPROM_93c56 1
-
-#define DEFAULT_FRAG_THRESHOLD 2342U
-#define MIN_FRAG_THRESHOLD 256U
-#define DEFAULT_BEACONINTERVAL 0x64U
-#define DEFAULT_BEACON_ESSID "Rtl8187"
-
-#define DEFAULT_SSID ""
-#define DEFAULT_RETRY_RTS 7
-#define DEFAULT_RETRY_DATA 7
-#define PRISM_HDR_SIZE 64
-
-#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30
-
-typedef struct buffer
-{
- struct buffer *next;
- u32 *buf;
-
-} buffer;
-
-#if 0
-
-typedef struct tx_pendingbuf
-{
- struct ieee80211_txb *txb;
- short ispending;
- short descfrag;
-} tx_pendigbuf;
-
-#endif
-
-typedef struct Stats
-{
- unsigned long txrdu;
-// unsigned long rxrdu;
- //unsigned long rxnolast;
- //unsigned long rxnodata;
-// unsigned long rxreset;
-// unsigned long rxwrkaround;
-// unsigned long rxnopointer;
- unsigned long rxok;
- unsigned long rxurberr;
- unsigned long rxstaterr;
- unsigned long txnperr;
- unsigned long txnpdrop;
- unsigned long txresumed;
-// unsigned long rxerr;
-// unsigned long rxoverflow;
-// unsigned long rxint;
- unsigned long txnpokint;
-// unsigned long txhpokint;
-// unsigned long txhperr;
-// unsigned long ints;
-// unsigned long shints;
- unsigned long txoverflow;
-// unsigned long rxdmafail;
-// unsigned long txbeacon;
-// unsigned long txbeaconerr;
- unsigned long txlpokint;
- unsigned long txlpdrop;
- unsigned long txlperr;
- unsigned long txdatapkt;
-} Stats;
-
-
-
-typedef struct r8180_priv
-{
- struct usb_device *udev;
- short epromtype;
- int irq;
- struct ieee80211_device *ieee80211;
-
- short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
- short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
- short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
- short enable_gpio0;
- enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
- short hw_plcp_len;
-
-// spinlock_t irq_lock;
-// spinlock_t irq_th_lock;
- spinlock_t tx_lock;
-
- u16 irq_mask;
-// short irq_enabled;
- struct net_device *dev;
- short chan;
- short sens;
- short max_sens;
- u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
- u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
- u8 cck_txpwr_base;
- u8 ofdm_txpwr_base;
- u8 challow[15]; //channels from 1 to 14, 0 not used
- short up;
- short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
-// struct timer_list scan_timer;
- /*short scanpending;
- short stopscan;*/
-// spinlock_t scan_lock;
-// u8 active_probe;
- //u8 active_scan_num;
- struct semaphore wx_sem;
-// short hw_wep;
-
-// short digphy;
-// short antb;
-// short diversity;
-// u8 cs_treshold;
-// short rcr_csense;
- short rf_chip;
-// u32 key0[4];
- short (*rf_set_sens)(struct net_device *dev,short sens);
- void (*rf_set_chan)(struct net_device *dev,short ch);
- void (*rf_close)(struct net_device *dev);
- void (*rf_init)(struct net_device *dev);
- //short rate;
- short promisc;
- /*stats*/
- struct Stats stats;
- struct iw_statistics wstats;
- struct proc_dir_entry *dir_dev;
-
- /*RX stuff*/
-// u32 *rxring;
-// u32 *rxringtail;
-// dma_addr_t rxringdma;
- struct urb **rx_urb;
-
- //struct buffer *rxbuffer;
- //struct buffer *rxbufferhead;
- //int rxringcount;
- //u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
-
- //short rx_skb_complete;
-
- //u32 rx_prevlen;
- atomic_t tx_lp_pending;
- atomic_t tx_np_pending;
-#if 0
- /*TX stuff*/
- u32 *txlpring;
- u32 *txhpring;
- u32 *txnpring;
- dma_addr_t txlpringdma;
- dma_addr_t txhpringdma;
- dma_addr_t txnpringdma;
- u32 *txlpringtail;
- u32 *txhpringtail;
- u32 *txnpringtail;
- u32 *txlpringhead;
- u32 *txhpringhead;
- u32 *txnpringhead;
- struct buffer *txlpbufs;
- struct buffer *txhpbufs;
- struct buffer *txnpbufs;
- struct buffer *txlpbufstail;
- struct buffer *txhpbufstail;
- struct buffer *txnpbufstail;
- int txringcount;
- int txbuffsize;
-
- //struct tx_pendingbuf txnp_pending;
- struct tasklet_struct irq_tx_tasklet;
-#endif
-// struct tasklet_struct irq_rx_tasklet;
-// u8 dma_poll_mask;
- //short tx_suspend;
-
- /* adhoc/master mode stuff */
-#if 0
- u32 *txbeacontail;
- dma_addr_t txbeaconringdma;
- u32 *txbeaconring;
- int txbeaconcount;
-#endif
-// struct ieee_tx_beacon *beacon_buf;
- //char *master_essid;
-// dma_addr_t beacondmabuf;
- //u16 master_beaconinterval;
-// u32 master_beaconsize;
- //u16 beacon_interval;
-
- u8 retry_data;
- u8 retry_rts;
-
- struct work_struct reset_wq;
-
-}r8180_priv;
-
-
-typedef enum{
- LOW_PRIORITY ,
- NORM_PRIORITY
- } priority_t;
-
-
-short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
-
-u8 read_nic_byte(struct net_device *dev, int x);
-u8 read_nic_byte_E(struct net_device *dev, int x);
-u32 read_nic_dword(struct net_device *dev, int x);
-u16 read_nic_word(struct net_device *dev, int x) ;
-void write_nic_byte(struct net_device *dev, int x,u8 y);
-void write_nic_byte_E(struct net_device *dev, int x,u8 y);
-void write_nic_word(struct net_device *dev, int x,u16 y);
-void write_nic_dword(struct net_device *dev, int x,u32 y);
-void force_pci_posting(struct net_device *dev);
-
-void rtl8180_rtx_disable(struct net_device *);
-void rtl8180_rx_enable(struct net_device *);
-void rtl8180_tx_enable(struct net_device *);
-
-void rtl8180_disassociate(struct net_device *dev);
-//void fix_rx_fifo(struct net_device *dev);
-void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a);
-
-void rtl8180_set_anaparam(struct net_device *dev,u32 a);
-void rtl8185_set_anaparam2(struct net_device *dev,u32 a);
-void rtl8180_update_msr(struct net_device *dev);
-int rtl8180_down(struct net_device *dev);
-int rtl8180_up(struct net_device *dev);
-void rtl8180_commit(struct net_device *dev);
-void rtl8180_set_chan(struct net_device *dev,short ch);
-void write_phy(struct net_device *dev, u8 adr, u8 data);
-void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
-void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
-void rtl8187_set_rxconf(struct net_device *dev);
-#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod
--- rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod 2006-06-22 07:40:15.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod 2008-02-15 00:49:48.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187.ko
-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187_core.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_93cx6.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_wx.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225z2.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c 2008-01-30 17:38:11.000000000 +0100
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2008-01-30 17:38:11.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h 2008-01-30 17:38:11.000000000 +0100
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c 2008-01-30 17:39:05.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,23 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 2, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +416,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +428,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +476,30 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,33 +533,59 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[0].page = virt_to_page(hdr);
sg[0].offset = offset_in_page(hdr);
sg[0].length = 16;
+#else
+ sg_set_page(&sg[0], virt_to_page(hdr), 16, offset_in_page(hdr));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[1].page = virt_to_page(data);
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#else
+ sg_set_page(&sg[1], virt_to_page(data), data_len, offset_in_page(data));
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +615,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +627,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +665,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +681,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +689,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +698,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +716,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +732,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +777,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +807,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +834,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c 2008-01-30 17:39:05.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,25 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +214,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +244,26 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +284,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +298,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +311,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +320,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h 2008-01-30 17:38:11.000000000 +0100
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c 2008-01-30 17:38:11.000000000 +0100
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c 2008-01-30 17:38:11.000000000 +0100
@@ -13,16 +13,15 @@
* more details.
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
-
+
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,89 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+#else
+ skb_reset_mac_header(skb);
+#endif
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +134,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +164,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +203,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +216,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +226,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +248,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,13 +257,13 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
-
+
return 0;
-
+
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
@@ -253,7 +323,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +364,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +374,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +409,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +419,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +437,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -413,7 +483,7 @@
last_seq = &ieee->last_seq_num;
last_frag = &ieee->last_frag_num;
last_time = &ieee->last_packet_time;
-
+
break;
default:
return 0;
@@ -436,7 +506,7 @@
drop:
// BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
// printk("DUP\n");
-
+
return 1;
}
@@ -444,7 +514,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -481,9 +551,9 @@
type = WLAN_FC_GET_TYPE(fc);
stype = WLAN_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctl);
-
+
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +571,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +599,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +625,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -573,9 +643,9 @@
goto rx_dropped;
}
#endif
-
-
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+
+
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -583,7 +653,7 @@
/* Data frame - extract src/dst addresses */
-
+
switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN);
@@ -606,7 +676,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +689,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +700,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +734,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +744,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +764,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +792,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +833,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -861,7 +931,12 @@
if (skb2 != NULL) {
/* send to wireless media */
skb2->protocol = __constant_htons(ETH_P_802_3);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb2->mac.raw = skb2->nh.raw = skb2->data;
+#else
+ skb_reset_mac_header(skb2);
+ skb_reset_network_header(skb2);
+#endif
/* skb2->nh.raw = skb2->data + ETH_HLEN; */
skb2->dev = dev;
dev_queue_xmit(skb2);
@@ -896,7 +971,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +988,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1039,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1066,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1089,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1043,47 +1118,47 @@
break;
case MFIE_TYPE_TIM:
-
- if(info_element->len < 4)
+
+ if(info_element->len < 4)
break;
-
+
network->dtim_period = info_element->data[1];
-
+
if(ieee->state != IEEE80211_LINKED)
break;
-
- network->last_dtim_sta_time[0] = stats->mac_time[0];
+
+ network->last_dtim_sta_time[0] = stats->mac_time[0];
network->last_dtim_sta_time[1] = stats->mac_time[1];
-
+
network->dtim_data = IEEE80211_DTIM_VALID;
-
- if(info_element->data[0] != 0)
+
+ if(info_element->data[0] != 0)
break;
-
+
if(info_element->data[2] & 1)
network->dtim_data |= IEEE80211_DTIM_MBCAST;
-
+
offset = (info_element->data[2] >> 1)*2;
-
- //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
-
- if(ieee->assoc_id < offset ||
+
+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
+
+ if(ieee->assoc_id < offset ||
ieee->assoc_id > 8*(offset + info_element->len -3))
-
+
break;
-
-
+
+
offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ;
-
- // printk("offset:%x data:%x, ucast:%d\n", offset,
+
+ // printk("offset:%x data:%x, ucast:%d\n", offset,
// info_element->data[3+offset] ,
// info_element->data[3+offset] & (1<<(ieee->assoc_id%8)));
-
+
if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
network->dtim_data |= IEEE80211_DTIM_UCAST;
-
+
break;
-
+
case MFIE_TYPE_IBSS_SET:
IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n");
break;
@@ -1115,7 +1190,7 @@
memcpy(network->rsn_ie, info_element,
network->rsn_ie_len);
break;
-
+
default:
IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
info_element->id);
@@ -1147,7 +1222,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,24 +1230,24 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
- * and the capability field (in particular IBSS and BSS) all match.
+ * and the capability field (in particular IBSS and BSS) all match.
* We treat all <hidden> with the same BSSID and channel
* as one network */
return ((src->ssid_len == dst->ssid_len) &&
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
- ((src->capability & WLAN_CAPABILITY_IBSS) ==
+ ((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
- ((src->capability & WLAN_CAPABILITY_BSS) ==
+ ((src->capability & WLAN_CAPABILITY_BSS) ==
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1194,7 +1269,7 @@
dst->dtim_data = src->dtim_data;
dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
-
+
memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len);
dst->wpa_ie_len = src->wpa_ie_len;
memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
@@ -1204,7 +1279,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1314,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1261,12 +1336,12 @@
* already there. */
spin_lock_irqsave(&ieee->lock, flags);
-
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
-
+
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
+
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1381,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1315,39 +1390,39 @@
WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
-
+
/* we have an entry and we are going to update it. But this entry may
- * be already expired. In this case we do the same as we found a new
+ * be already expired. In this case we do the same as we found a new
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_BEACON:
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
-
+
case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1430,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c 2008-01-30 17:38:11.000000000 +0100
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,211 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
+ if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE);
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,166 +882,181 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1067,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1092,19 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
- printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+ printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10));
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1087,44 +1112,45 @@
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1158,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1218,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1311,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1338,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1477,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1488,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1631,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1656,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1670,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1687,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1717,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1739,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1767,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1790,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
{
-
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1887,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1918,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
- ieee->rate = 540;
+
+// ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
- ieee->rate = 110;
+// ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1963,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1973,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2025,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
+
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2149,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2181,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2258,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2279,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2291,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2315,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2348,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2399,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2416,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2455,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2469,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2490,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2573,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2585,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2600,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2629,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2645,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c 2008-01-30 17:38:11.000000000 +0100
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c 2008-01-30 17:38:11.000000000 +0100
@@ -24,15 +24,14 @@
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -299,27 +304,27 @@
}
if(likely(ieee->raw_tx == 0)){
-
+
if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
-
+
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-
+
crypt = ieee->crypt[ieee->tx_keyidx];
-
+
encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
ieee->host_encrypt && crypt && crypt->ops;
-
+
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
stats->tx_dropped++;
goto success;
}
-
+
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !encrypt && ether_type == ETH_P_PAE) {
struct eapol *eap = (struct eapol *)(skb->data +
@@ -328,23 +333,23 @@
eap_get_type(eap->type));
}
#endif
-
+
/* Save source and destination addresses */
memcpy(&dest, skb->data, ETH_ALEN);
memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
-
+
/* Advance the SKB to the start of the payload */
skb_pull(skb, sizeof(struct ethhdr));
-
+
/* Determine total amount of storage required for TXB packets */
bytes = skb->len + SNAP_SIZE + sizeof(u16);
-
+
if (encrypt)
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_WEP;
else
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
-
+
if (ieee->iw_mode == IW_MODE_INFRA) {
fc |= IEEE80211_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -360,9 +365,9 @@
memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
}
header.frame_ctl = cpu_to_le16(fc);
-
+
hdr_len = IEEE80211_3ADDR_LEN;
-
+
/* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */
if (is_multicast_ether_addr(dest) ||
@@ -370,7 +375,7 @@
frag_size = MAX_FRAG_THRESHOLD;
else
frag_size = ieee->fts;
-
+
/* Determine amount of payload per fragment. Regardless of if
* this stack is providing the full 802.11 header, one will
* eventually be affixed to this fragment -- so we must account for
@@ -379,12 +384,12 @@
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
bytes_per_frag -= IEEE80211_FCS_LEN;
-
+
/* Each fragment may need to have room for encryptiong pre/postfix */
if (encrypt)
bytes_per_frag -= crypt->ops->extra_prefix_len +
crypt->ops->extra_postfix_len;
-
+
/* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */
nr_frags = bytes / bytes_per_frag;
@@ -393,11 +398,11 @@
nr_frags++;
else
bytes_last_frag = bytes_per_frag;
-
+
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -405,93 +410,94 @@
}
txb->encrypted = encrypt;
txb->payload_size = bytes;
-
+
for (i = 0; i < nr_frags; i++) {
skb_frag = txb->fragments[i];
-
+
if (encrypt)
skb_reserve(skb_frag, crypt->ops->extra_prefix_len);
-
+
frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len);
memcpy(frag_hdr, &header, hdr_len);
-
+
/* If this is not the last fragment, then add the MOREFRAGS
* bit to the frame control */
if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16(
fc | IEEE80211_FCTL_MOREFRAGS);
bytes = bytes_per_frag;
-
+
} else {
/* The last fragment takes the remaining length */
bytes = bytes_last_frag;
}
-
+
frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i);
-
-
+
+
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
}
-
+
memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
-
+
/* Advance the SKB... */
skb_pull(skb, bytes);
-
+
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
}
- // Advance sequence number in data frame.
+ // Advance sequence number in data frame.
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
- }
+ }
success:
spin_unlock_irqrestore(&ieee->lock, flags);
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
-
-
+
+
}
return 0;
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c 2008-01-30 17:38:11.000000000 +0100
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -259,6 +260,9 @@
int i, key, key_provided, len;
struct ieee80211_crypt_data **crypt;
+ if (erq->flags & IW_ENCODE_RESTRICTED)
+ return -EINVAL;
+
IEEE80211_DEBUG_WX("SET_ENCODE\n");
key = erq->flags & IW_ENCODE_INDEX;
@@ -281,7 +285,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +295,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +318,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +330,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +344,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +422,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +434,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +474,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile 2008-01-30 17:38:11.000000000 +0100
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2008-02-15 00:49:47.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2008-02-15 00:49:47.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2008-02-15 00:49:47.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2008-02-15 00:49:47.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod 2008-02-15 00:49:47.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_rx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_tx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_wx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_module.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac_wx.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.o
diff -Naur rtl8187_linux_26.1010.0622.2006/makedrv~ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~
--- rtl8187_linux_26.1010.0622.2006/makedrv~ 2006-09-05 07:21:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-#tar -zxvf stack.tar.gz
-#tar -zxvf drv.tar.gz
-cd ieee80211
-make clean
-make
-cd ../beta-8187
-make clean
-make
-cd ..
-
-
diff -Naur rtl8187_linux_26.1010.0622.2006/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/Makefile
--- rtl8187_linux_26.1010.0622.2006/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_linux_26.1010.0622.2006_rawtx/Makefile 2008-01-30 17:39:29.000000000 +0100
@@ -0,0 +1,38 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~
--- rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ 2006-06-06 10:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,129 +0,0 @@
-Release Date: 2006-01-13, ver 1.1
-RTL8187 Linux driver version 1.1
-
- --This driver supports RealTek RTL8187 Wireless LAN driver for
- Fedora Core 2/3/4/5, Debian 3.1, Mandrake 10.2/Mandriva 2006,
- SUSE 9.3/10.1/10.2, Gentoo 3.1, etc.
- - Support Client mode for either infrastructure or adhoc mode
- - Support WEP and WPAPSK connection
-
-< Component >
-The driver is composed of several parts:
- 1. Module source code
- stack.tar.gz
- drv.tar.gz
-
- 2. Script ot build the modules
- makedrv
-
- 3. Script to load/unload modules
- wlan0up
- wlan0down
-
- 4. Script and configuration for DHCP
- wlan0dhcp
- ifcfg-wlan0
- 4. Supplicant source code:
- wpa_supplicant-0.4.9.tar.gz
-
- 5. Example of supplicant configuration file:
- wpa1.conf
-
-< Installation >
-Runing the scripts can finish all operations of building up modules
-from the source code and start the nic.
- 1. Build up the drivers from the source code
- ./makedrv
-
- 2. load the driver module to kernel and start up nic
- ./wlan0up
-
-< Set wireless lan MIBs >
-This driver uses Wireless Extension as an interface allowing you to set
-Wireless LAN specific parameters.
-
-Current driver supports "iwlist" to show the device status of nic
- iwlist wlan0 [parameters]
-where
- parameter explaination [parameters]
- ----------------------- -------------
- Show available chan and freq freq / channel
- Show and Scan BSS and IBSS scan[ning]
- Show supported bit-rate rate / bit[rate]
- Show Power Management mode power
-
-For example:
- iwlist wlan0 channel
- iwlist wlan0 scan
- iwlist wlan0 rate
- iwlist wlan0 power
-
-Driver also supports "iwconfig", manipulate driver private ioctls, to set
-MIBs.
-
- iwconfig wlan0 [parameters] [val]
-where
- parameter explaination [parameters] [val] constraints
- ----------------------- ------------- ------------------
- Connect to AP by address ap [mac_addr]
- Set the essid, join (I)BSS essid [essid]
- Set operation mode mode {Managed|Ad-hoc}
- Set keys and security mode key/enc[ryption] {N|open|restricted|off}
-
-For example:
- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
- iwconfig wlan0 essid "ap_name"
- iwconfig wlan0 mode Ad-hoc
- iwconfig wlan0 mode essid "name" mode Ad-hoc
- iwconfig wlan0 key 0123456789 [2] open
- iwconfig wlan0 key off
- iwconfig wlan0 key restricted [3] 0123456789
-
-< Getting IP address >
-After start up the nic, the network needs to obtain an IP address before
-transmit/receive data.
-This can be done by setting the static IP via "ifconfig wlan0 IP_ADDRESS"
-command, or using DHCP.
-
-If using DHCP, setting steps is as below:
- (1)connect to an AP via "iwconfig" settings
- iwconfig wlan0 essid [name] or
- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
-
- (2)run the script which run the dhclient
- ./wlan0dhcp
-
-< WPAPSK >
-WPA_SUPPLICANT help the network to communicate under the protection of WPAPSK
-mechanism
-
- (1)Unpack source code of WPA supplicant:
- tar -zxvf wpa_supplicant-0.4.9.tar.gz
- cd wpa_supplicant-0.4.9
-
- (2)Create .config file:
- cp defconfig .config
-
- (3)Edit .config file, uncomment the following line:
- #CONFIG_DRIVER_IPW=y.
-
- (4)Build WPA supplicant:
- make
-
- (5)Edit wpa_supplicant.conf to set up SSID and its passphrase.
- For example, the following setting in "wpa1.conf" means SSID
- to join is "BufAG54_Ch6" and its passphrase is "87654321".
- network={
- ssid="BufAG54_Ch6"
- proto=WPA
- key_mgmt=WPA-PSK
- pairwise=CCMP TKIP
- group=CCMP TKIP WEP104 WEP40
- psk="87654321"
- priority=2
- }
-
- (6)Execute WPA supplicant (Assume 8187 and related modules had been
- loaded):
- ./wpa_supplicant -D ipw -c wpa1.conf -i wlan0 &
-
diff -Naur rtl8187_linux_26.1010.0622.2006/symvers rtl8187_linux_26.1010.0622.2006_rawtx/symvers
--- rtl8187_linux_26.1010.0622.2006/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_linux_26.1010.0622.2006_rawtx/symvers 2008-01-30 17:38:11.000000000 +0100
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_linux_26.1010.0622.2006/wlan0rmv rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv
--- rtl8187_linux_26.1010.0622.2006/wlan0rmv 2006-09-05 07:21:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv 2008-01-30 17:38:11.000000000 +0100
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmod rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
Patch | aircrack-ng/patches/old/rtl8187_2.6.24v3.patch | diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211_crypt.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211_crypt.h 2008-01-30 17:38:10.000000000 +0100
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/ieee80211.h 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/ieee80211.h 2008-01-30 17:38:10.000000000 +0100
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile
--- rtl8187_linux_26.1010.0622.2006/beta-8187/Makefile 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/Makefile 2008-01-30 17:38:10.000000000 +0100
@@ -18,6 +18,8 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
+
all: modules
clean:
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_93cx6.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.c 2008-01-30 17:38:10.000000000 +0100
@@ -87,7 +87,7 @@
u32 eprom_read(struct net_device *dev, u32 addr)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short read_cmd[]={1,1,0};
short addr_str[8];
int i;
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_hw.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_hw.h 2008-01-30 17:38:11.000000000 +0100
@@ -646,6 +646,7 @@
#define FFER_INTR ((1<<15))
#define FFER_GWAKE ((1<< 4))
-
+#define MAX_TX_POWER 27
+#define MIN_TX_POWER 20
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.c 2008-01-30 17:38:11.000000000 +0100
@@ -173,7 +173,7 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
@@ -208,7 +208,7 @@
{
#ifdef USE_8051_3WIRE
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
//u8 bit;
u16 wReg80, wReg82, wReg84;
@@ -255,7 +255,7 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
@@ -349,7 +349,7 @@
void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int GainIdx;
int GainSetting;
@@ -454,9 +454,9 @@
void rtl8225_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
rtl8225_SetTXPowerLevel(dev, ch);
@@ -474,7 +474,7 @@
write_nic_byte(dev,DIFS,0x24); //DIFS: 36
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
else
@@ -546,7 +546,7 @@
void rtl8225_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.h 2008-01-30 17:38:11.000000000 +0100
@@ -44,3 +44,5 @@
extern u32 rtl8225_chan[];
#endif
+
+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_rtl8225z2.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.c 2008-02-15 00:49:20.000000000 +0100
@@ -2,12 +2,12 @@
This is part of the rtl8180-sa2400 driver
released under the GPL (See file COPYING for details).
Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
- This files contains programming code for the rtl8225
+
+ This files contains programming code for the rtl8225
radio frontend.
-
+
*Many* thanks to Realtek Corp. for their great support!
-
+
*/
@@ -32,51 +32,68 @@
};
u8 rtl8225z2_gain_a[]={
- 0x13,0x27,0x5a,//,0x37,// -82dbm
- 0x23,0x23,0x58,//,0x37,// -82dbm
- 0x33,0x1f,0x56,//,0x37,// -82dbm
- 0x43,0x1b,0x54,//,0x37,// -78dbm
- 0x53,0x17,0x51,//,0x37,// -74dbm
- 0x63,0x24,0x4f,//,0x37,// -70dbm
- 0x73,0x0f,0x4c,//,0x37,// -66dbm
+ 0x13,0x27,0x5a,//,0x37,// -82dbm
+ 0x23,0x23,0x58,//,0x37,// -82dbm
+ 0x33,0x1f,0x56,//,0x37,// -82dbm
+ 0x43,0x1b,0x54,//,0x37,// -78dbm
+ 0x53,0x17,0x51,//,0x37,// -74dbm
+ 0x63,0x24,0x4f,//,0x37,// -70dbm
+ 0x73,0x0f,0x4c,//,0x37,// -66dbm
};
#if 0
u32 rtl8225_chan[] = {
0, //dummy channel 0
- 0x085c, //1
- 0x08dc, //2
- 0x095c, //3
- 0x09dc, //4
- 0x0a5c, //5
- 0x0adc, //6
- 0x0b5c, //7
- 0x0bdc, //8
- 0x0c5c, //9
- 0x0cdc, //10
- 0x0d5c, //11
- 0x0ddc, //12
- 0x0e5c, //13
+ 0x085c, //1
+ 0x08dc, //2
+ 0x095c, //3
+ 0x09dc, //4
+ 0x0a5c, //5
+ 0x0adc, //6
+ 0x0b5c, //7
+ 0x0bdc, //8
+ 0x0c5c, //9
+ 0x0cdc, //10
+ 0x0d5c, //11
+ 0x0ddc, //12
+ 0x0e5c, //13
//0x0f5c, //14
- 0x0f72, // 14
+ 0x0f72, // 14
};
#endif
+#if 1
//-
-u16 rtl8225z2_rxgain[]={
+u16 rtl8225z2_rxgain[]={
0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
};
+#else
+u16 rtl8225z2_rxgain[]={
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+ 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+ 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+ 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+ 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+ 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+ 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+ 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+ 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+#endif
//2005.11.16,
u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
@@ -129,23 +146,30 @@
void rtl8225z2_set_gain(struct net_device *dev, short gain)
{
u8* rtl8225_gain;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
u8 mode = priv->ieee80211->mode;
-
- if(mode == IEEE_B || mode == IEEE_G)
+
+ if((mode&IEEE_B) == IEEE_B || (mode&IEEE_G) == IEEE_G) {
+ //printk(KERN_WARNING "mode ag!\n");
rtl8225_gain = rtl8225z2_gain_bg;
- else
+ } else {
rtl8225_gain = rtl8225z2_gain_a;
-
+ //printk(KERN_WARNING "mode a!\n");
+ }
+
//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
//2005.11.17, by ch-hsu
write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+ mdelay(1);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
- write_phy_ofdm(dev, 0x21, 0x37);
+ mdelay(1);
+ write_phy_ofdm(dev, 0x21, 0x17);
+ mdelay(1);
}
@@ -153,33 +177,33 @@
void rtl8225_set_gain(struct net_device *dev, short gain)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_8185 == 2)
write_phy_ofdm(dev, 0x21, 0x27);
else
write_phy_ofdm(dev, 0x21, 0x37);
-
+
write_phy_ofdm(dev, 0x25, 0x20);
write_phy_ofdm(dev, 0x11, 0x6);
-
+
if(priv->card_8185 == 1 && priv->card_8185_Bversion)
write_phy_ofdm(dev, 0x27, 0x8);
else
write_phy_ofdm(dev, 0x27, 0x88);
-
+
write_phy_ofdm(dev, 0x14, 0);
write_phy_ofdm(dev, 0x16, 0);
write_phy_ofdm(dev, 0x15, 0x40);
write_phy_ofdm(dev, 0x17, 0x40);
-
+
write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
- //rtl8225_set_gain_usb(dev, gain);
+ //rtl8225_set_gain_usb(dev, gain);
}
#endif
@@ -193,7 +217,7 @@
// ThreeWireReg tdata;
int i;
short bit, rw;
-
+
u8 wLength = 6;
u8 rLength = 12;
u8 low2high = 0;
@@ -207,20 +231,20 @@
dataRead = 0;
- oval &= ~0xf;
+ oval &= ~0xf;
write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4);
write_nic_word(dev, RFPinsOutput, oval ); udelay(5);
-
+
rw = 0;
-
+
mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
for(i = 0; i < wLength/2; i++)
{
bit = ((data2Write&mask) != 0) ? 1 : 0;
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
@@ -233,9 +257,9 @@
write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
break;
}
-
+
bit = ((data2Write&mask) != 0) ? 1: 0;
-
+
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2);
@@ -252,22 +276,22 @@
for(i = 0; i < rLength; i++)
{
write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
-
+
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
tmp = read_nic_word(dev, RFPinsInput);
-
+
dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0);
write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2);
mask = (low2high) ? (mask<<1) : (mask>>1);
}
-
+
write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
- write_nic_word(dev, RFPinsEnable, oval2);
+ write_nic_word(dev, RFPinsEnable, oval2);
write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch
write_nic_word(dev, RFPinsOutput, 0x3a0);
@@ -280,61 +304,61 @@
u16 out,select;
u8 bit;
u32 bangdata = (data << 4) | (adr & 0xf);
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
+
write_nic_word(dev,RFPinsEnable,
(read_nic_word(dev,RFPinsEnable) | 0x7));
-
+
select = read_nic_word(dev, RFPinsSelect);
-
- write_nic_word(dev, RFPinsSelect, select | 0x7 |
+
+ write_nic_word(dev, RFPinsSelect, select | 0x7 |
((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
+
force_pci_posting(dev);
udelay(10);
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
+
force_pci_posting(dev);
udelay(2);
-
+
write_nic_word(dev, RFPinsOutput, out);
-
+
force_pci_posting(dev);
udelay(10);
-
-
+
+
for(i=15; i>=0;i--){
-
+
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out);
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
i--;
bit = (bangdata & (1<<i)) >> i;
-
+
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
write_nic_word(dev, RFPinsOutput, bit | out);
}
-
+
write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
+
force_pci_posting(dev);
udelay(10);
- write_nic_word(dev, RFPinsOutput, out |
+ write_nic_word(dev, RFPinsOutput, out |
((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
- write_nic_word(dev, RFPinsSelect, select |
- ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+ write_nic_word(dev, RFPinsSelect, select |
+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
if(priv->card_type == USB)
mdelay(2);
@@ -348,30 +372,30 @@
short vz2 = 1;
/* sw to reg pg 1 */
write_rtl8225(dev, 0, 0x1b7);
-
+
/* reg 8 pg 1 = 23*/
if( read_rtl8225(dev, 8) != 0x588)
vz2 = 0;
-
- else /* reg 9 pg 1 = 24 */
+
+ else /* reg 9 pg 1 = 24 */
if( read_rtl8225(dev, 9) != 0x700)
vz2 = 0;
-
- /* sw back to pg 0 */
+
+ /* sw back to pg 0 */
write_rtl8225(dev, 0, 0xb7);
return vz2;
-
+
}
#if 0
void rtl8225_rf_close(struct net_device *dev)
{
- write_rtl8225(dev, 0x4, 0x1f);
-
+ write_rtl8225(dev, 0x4, 0x1f);
+
force_pci_posting(dev);
mdelay(1);
-
+
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
}
@@ -380,24 +404,24 @@
short rtl8225_rf_set_sens(struct net_device *dev, short sens)
{
if (sens <0 || sens > 6) return -1;
-
+
if(sens > 4)
write_rtl8225(dev, 0x0c, 0x850);
- else
+ else
write_rtl8225(dev, 0x0c, 0x50);
sens= 6-sens;
rtl8225_set_gain(dev, sens);
-
+
write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
return 0;
-
+
}
#endif
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
// int GainIdx;
// int GainSetting;
int i;
@@ -406,44 +430,48 @@
u8 max_cck_power_level;
//u8 min_cck_power_level;
u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
+ u8 min_ofdm_power_level;
u8 cck_power_level = 0xff & priv->chtxpwr[ch];
u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-
- max_cck_power_level = 15;
+
+
+ max_cck_power_level = 35;
//min_cck_power_level = 0;
- max_ofdm_power_level = 25; // 12 -> 25
+ max_ofdm_power_level = 35; // 12 -> 25
min_ofdm_power_level = 10;
-
+
/* CCK power setting */
if(cck_power_level > max_cck_power_level)
+ {
cck_power_level = max_cck_power_level;
-
+ priv->chtxpwr[ch] = max_cck_power_level;
+ }
+
cck_power_level += priv->cck_txpwr_base;
-
+
if(cck_power_level > 35)
cck_power_level = 35;
-
- if(ch == 14)
+
+ if(ch == 14)
cck_power_table = rtl8225z2_tx_power_cck_ch14;
- else
+ else
cck_power_table = rtl8225z2_tx_power_cck;
-
-
+
+ if(cck_power_level >= 20 && cck_power_level < 30)
+ cck_power_level = 19;
+
for(i=0;i<8;i++){
-
power = cck_power_table[i];
write_phy_cck(dev, 0x44 + i, power);
}
-
+
//write_nic_byte(dev, TX_GAIN_CCK, power);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_CCK, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
-
+
/* OFDM power setting */
// Old:
// if(ofdm_power_level > max_ofdm_power_level)
@@ -454,26 +482,26 @@
ofdm_power_level = max_ofdm_power_level;
else
ofdm_power_level += min_ofdm_power_level;
-
+
ofdm_power_level += priv->ofdm_txpwr_base;
-
+
if(ofdm_power_level > 35)
ofdm_power_level = 35;
-
+
rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
+
write_phy_ofdm(dev,2,0x42);
write_phy_ofdm(dev,5,0);
write_phy_ofdm(dev,6,0x40);
write_phy_ofdm(dev,7,0);
- write_phy_ofdm(dev,8,0x40);
-
+ write_phy_ofdm(dev,8,0x40);
+
//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
//2005.11.17,
write_nic_byte(dev, TX_GAIN_OFDM, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]);
-
+
force_pci_posting(dev);
mdelay(1);
//write_nic_byte(dev, TX_AGC_CONTROL,4);
@@ -483,39 +511,39 @@
void rtl8225_set_mode(struct net_device *dev, short modeb)
{
write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
- write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
+ write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
}
#endif
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(priv->ieee80211->current_network)) ||
+ ieee80211_is_54g_rtl7(priv->ieee80211->current_network)) ||
priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
+
rtl8225z2_SetTXPowerLevel(dev, ch);
-
+
write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
+
force_pci_posting(dev);
mdelay(10);
-
+
write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
+
if(gset)
- write_nic_byte(dev,DIFS,20); //DIFS: 20
+ write_nic_byte(dev,DIFS,20); //DIFS: 20
else
- write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36
+
if(priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(priv->ieee80211->current_network))
+ ieee80211_is_shortslot_rtl7(priv->ieee80211->current_network))
write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
+
else
write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
+
+
if(gset){
write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
@@ -529,68 +557,68 @@
}
#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
+void rtl8225_host_pci_init(struct net_device *dev)
{
write_nic_word(dev, RFPinsOutput, 0x480);
-
+
rtl8185_rf_pins_enable(dev);
-
+
//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
//write_nic_word(dev, RFPinsSelect, 0x88);
//else
write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
+
write_nic_byte(dev, GP_ENABLE, 0);
-
+
force_pci_posting(dev);
mdelay(200);
-
+
write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
+
}
-void rtl8225_host_usb_init(struct net_device *dev)
+void rtl8225_host_usb_init(struct net_device *dev)
{
write_nic_byte(dev,RFPinsSelect+1,0);
write_nic_byte(dev,GPIO,0);
-
+
write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
+
write_nic_byte(dev,RFPinsSelect+1,4);
write_nic_byte(dev,GPIO,0x20);
write_nic_byte(dev,GP_ENABLE,0);
-
- /* Config BB & RF */
+
+ /* Config BB & RF */
write_nic_word(dev, RFPinsOutput, 0x80);
write_nic_word(dev, RFPinsSelect, 0x80);
write_nic_word(dev, RFPinsEnable, 0x80);
-
+
mdelay(100);
- mdelay(1000);
+ mdelay(1000);
}
#endif
-void rtl8225z2_rf_init(struct net_device *dev)
+void rtl8225z2_rf_init(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
short channel = 1;
u16 brsr;
u32 data,addr;
-
+
priv->chan = channel;
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
+
if(priv->card_type == USB)
rtl8225_host_usb_init(dev);
@@ -598,42 +626,42 @@
rtl8225_host_pci_init(dev);
write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
+
brsr = read_nic_word(dev, BRSR);
-
- write_nic_word(dev, BRSR, 0xffff);
+
+ write_nic_word(dev, BRSR, 0xffff);
write_nic_dword(dev, RF_PARA, 0x100044);
-
+
#if 1 //0->1
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_byte(dev, CONFIG3, 0x44);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
#endif
-
-
+
+
rtl8185_rf_pins_enable(dev);
// mdelay(1000);
write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
+
+
write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
+
write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
+
+
+
write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
// }
-
+
write_rtl8225(dev, 0x6, 0xe6); mdelay(1);
write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1);
@@ -653,28 +681,28 @@
write_rtl8225(dev, 0xe, 0x2b); mdelay(1);
- write_rtl8225(dev, 0xf, 0x114);
-
-
+ write_rtl8225(dev, 0xf, 0x114);
+
+
mdelay(100);
-
-
+
+
//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
+
write_rtl8225(dev, 0x0, 0x1b7);
-
+
for(i=0;i<95;i++){
write_rtl8225(dev, 0x1, (u8)(i+1));
-
+
#if 0
- if(priv->phy_ver == 1)
+ if(priv->phy_ver == 1)
/* version A */
write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
else
#endif
/* version B & C & D*/
-
+
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
write_rtl8225(dev, 0x3, 0x80);
@@ -683,16 +711,16 @@
write_rtl8225(dev, 0x0, 0xb7);
write_rtl8225(dev, 0x2, 0xc4d);
-
+
if(priv->card_type == USB){
// force_pci_posting(dev);
mdelay(200);
-
+
write_rtl8225(dev, 0x2, 0x44d);
-
+
// force_pci_posting(dev);
mdelay(100);
-
+
}//End of if(priv->card_type == USB)
/* FIXME!! rtl8187 we have to check if calibrarion
* is successful and eventually cal. again (repeat
@@ -713,23 +741,23 @@
}
}
//force_pci_posting(dev);
-
- mdelay(200); //200 for 8187
-
-
+
+ mdelay(200); //200 for 8187
+
+
// //if(priv->card_type != USB){
// write_rtl8225(dev, 0x2, 0x44d);
// write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
// write_rtl8225(dev, 0x2, 0x47d);
-//
+//
// force_pci_posting(dev);
// mdelay(100);
-//
+//
// write_rtl8225(dev, 0x2, 0x44d);
// //}
-
- write_rtl8225(dev, 0x0, 0x2bf);
-
+
+ write_rtl8225(dev, 0x0, 0x2bf);
+
if(priv->card_type != USB)
rtl8185_rf_pins_enable(dev);
//set up ZEBRA AGC table, 2005.11.17,
@@ -744,20 +772,20 @@
mdelay(1);
}
-#if 0
+#if 0
for(i=0;i<128;i++){
write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
- mdelay(1);
+
+ mdelay(1);
write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
- mdelay(1);
+
+ mdelay(1);
}
#endif
-
+
force_pci_posting(dev);
mdelay(1);
-
+
write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
@@ -771,20 +799,20 @@
write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
- //write_phy_ofdm(dev, 0x18, 0xef);
+ //write_phy_ofdm(dev, 0x18, 0xef);
// }
//}
write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
+
//if(priv->card_type != USB)
- write_phy_ofdm(dev, 0xd, 0x43);
-
+ write_phy_ofdm(dev, 0xd, 0x43);
+
write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
+
#if 0
if(priv->card_8185 == 1){
if(priv->card_8185_Bversion)
@@ -796,17 +824,17 @@
write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
/*ver D & 8187*/
// }
-
+
// if(priv->card_8185 == 1 && priv->card_8185_Bversion)
// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
// else
write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
/*ver C & D & 8187*/
-
+
write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
/*agc resp time 700*/
-
+
// if(priv->card_8185 == 2){
/* Ver D & 8187*/
write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
@@ -824,47 +852,46 @@
write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
+
// if (priv->card_type == USB)
// write_phy_ofdm(dev, 0x18, 0xef);
-
+
write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
+
write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
+
write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
+
write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
// }
-
+
write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
+
write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
// if(priv->card_type != USB)
write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+
write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-
+
// <> Set init. gain to m74dBm.
-
rtl8225z2_set_gain(dev,4);
-
+
write_phy_cck(dev, 0x0, 0x98); mdelay(1);
write_phy_cck(dev, 0x3, 0x20); mdelay(1);
write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
@@ -875,6 +902,9 @@
/* Ver C & D & 8187*/
write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
+ write_phy_cck(dev, 0x9, 0x11);mdelay(1);
+ write_phy_cck(dev, 0xa, 0x17);mdelay(1);
+ write_phy_cck(dev, 0xb, 0x11);mdelay(1);
write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
write_phy_cck(dev, 0x11, 0x88); mdelay(1);
@@ -885,52 +915,59 @@
else
#endif
write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
- write_phy_cck(dev, 0x19, 0x0);
- write_phy_cck(dev, 0x1a, 0xa0);
- write_phy_cck(dev, 0x1b, 0x8);
- write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
- write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
+// write_phy_cck(dev, 0x19, 0x0);
+// write_phy_cck(dev, 0x1a, 0xa0);
+// write_phy_cck(dev, 0x1b, 0x8);
+// write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
+ write_phy_cck(dev, 0x19, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1);
+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1);
+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1);
+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1);
+ write_phy_cck(dev, 0x41, 0x86); mdelay(1);
+
+
+// write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
+
+
write_phy_cck(dev, 0x42, 0x15); mdelay(1);
write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
+
+
write_phy_cck(dev, 0x44, 0x36); mdelay(1);
write_phy_cck(dev, 0x45, 0x35); mdelay(1);
write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
write_phy_cck(dev, 0x47, 0x25); mdelay(1);
write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
write_phy_cck(dev, 0x49, 0x12); mdelay(1);
- write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
- write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
+
// <>
// // TESTR 0xb 8187
// write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
+//
// //if(priv->card_type != USB){
// write_phy_ofdm(dev, 0x2, 0x62);
// write_phy_ofdm(dev, 0x6, 0x0);
// write_phy_ofdm(dev, 0x8, 0x0);
// //}
-
+
rtl8225z2_SetTXPowerLevel(dev, channel);
-
+
write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
+
rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
- /* switch to high-speed 3-wire
+
+ /* switch to high-speed 3-wire
* last digit. 2 for both cck and ofdm
*/
if(priv->card_type == USB)
@@ -943,23 +980,23 @@
// if(priv->card_type != USB)
// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
+//
// /* make sure is waken up! */
// write_rtl8225(dev,0x4, 0x9ff);
-// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8225_rf_set_chan(dev, priv->chan);
//write_nic_word(dev,BRSR,brsr);
-
+
//rtl8225z2_rf_set_mode(dev);
}
-void rtl8225z2_rf_set_mode(struct net_device *dev)
+void rtl8225z2_rf_set_mode(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(priv->ieee80211->mode == IEEE_A)
{
write_rtl8225(dev, 0x5, 0x1865);
@@ -970,15 +1007,15 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x10000000);
}else{
-
+
write_rtl8225(dev, 0x5, 0x1864);
write_nic_dword(dev, RF_PARA, 0x10044);
write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -987,12 +1024,12 @@
write_phy_ofdm(dev, 0xb, 0x99);
write_phy_ofdm(dev, 0xf, 0x20);
write_phy_ofdm(dev, 0x11, 0x7);
-
+
rtl8225z2_set_gain(dev,4);
-
+
write_phy_ofdm(dev,0x15, 0x40);
write_phy_ofdm(dev,0x17, 0x40);
-
+
write_nic_dword(dev, 0x94,0x04000002);
}
}
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8180_wx.c 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.c 2008-02-22 15:32:50.000000000 +0100
@@ -1,19 +1,19 @@
-/*
+/*
This file contains wireless extension handlers.
This is part of rtl8180 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part
+
+ Parts of this driver are based on the GPL part
of the official realtek driver.
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -21,20 +21,21 @@
#include "r8187.h"
#include "r8180_hw.h"
+#include "r8180_rtl8225.h"
#define RATE_COUNT 4
u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-
+
static int r8180_wx_get_freq(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_freq_rtl7(priv->ieee80211,a,wrqu,b);
}
@@ -45,28 +46,28 @@
{
int *parms = (int *)b;
int bi = parms[0];
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
DMESG("setting beacon interval to %x",bi);
-
+
priv->ieee80211->beacon_interval=bi;
rtl8180_commit(dev);
up(&priv->wx_sem);
-
- return 0;
+
+ return 0;
}
static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
-
+
priv->ieee80211->force_associate = (parms[0] > 0);
-
+
return 0;
}
@@ -75,108 +76,228 @@
static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv=ieee80211_priv(dev);
+ struct r8180_priv *priv=ieee80211_priv_rtl7(dev);
- return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
+ return ieee80211_wx_get_mode_rtl7(priv->ieee80211,a,wrqu,b);
}
-static int r8180_wx_get_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_rate_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_set_rate(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_rate(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
+ ret = ieee80211_wx_set_rate_rtl7(priv->ieee80211,info,wrqu,extra);
- ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_rawtx(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
+static int r8180_wx_get_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i=0;
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-
+ wrqu->power.value = 0;
+ for(i=0; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > wrqu->power.value) wrqu->power.value = priv->chtxpwr_ofdm[i];
+ }
+ wrqu->power.fixed = 1;
+ wrqu->power.flags = IW_TXPOW_DBM;
+ wrqu->power.disabled = 0;
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+#if 1
+static int r8180_wx_set_txpow(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ int ret = 0, i=0;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ down(&priv->wx_sem);
+
+ if (wrqu->power.flags != IW_TXPOW_DBM)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(!(priv->highpower) && wrqu->power.value > priv->txpwr_max)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value > 35)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if(wrqu->power.value < 0)
+ {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i] - (priv->txpwr_max - wrqu->power.value);
+// if(priv->chtxpwr[i] > priv->chtxpwr_orig[i]) priv->chtxpwr[i] = 0;
+
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i] - (priv->txpwr_max - wrqu->power.value);
+// if(priv->chtxpwr_ofdm[i] > priv->chtxpwr_ofdm_orig[i]) priv->chtxpwr_ofdm[i] = 0;
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+
+ out:
+ up(&priv->wx_sem);
+
return ret;
-
+
}
+#endif
-static int r8180_wx_set_crcmon(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_crcmon(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = priv->crcmon;
down(&priv->wx_sem);
-
- if(enable)
+
+ if(enable)
priv->crcmon=1;
- else
+ else
priv->crcmon=0;
- DMESG("bad CRC in monitor mode are %s",
+ DMESG("bad CRC in monitor mode are %s",
priv->crcmon ? "accepted" : "rejected");
if(prev != priv->crcmon && priv->up){
rtl8180_down(dev);
rtl8180_up(dev);
}
-
+
+ up(&priv->wx_sem);
+
+ return 0;
+}
+
+static int r8180_wx_set_fasttx(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ short prev = priv->fasttx;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->fasttx=1;
+ else
+ priv->fasttx=0;
+
+ DMESG("Transmission method (regarding speed) set to: %s",
+ priv->fasttx ? "fast" : "normal");
+
+ if(prev != priv->fasttx && priv->up){
+ rtl8180_down(dev);
+ rtl8180_up(dev);
+ }
+
up(&priv->wx_sem);
-
+
+ return 0;
+}
+
+static int r8180_wx_set_highpower(struct net_device *dev,
+ struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int *parms = (int *)extra;
+ int enable = (parms[0] > 0);
+ int i=0;
+ short prev = priv->highpower;
+
+ down(&priv->wx_sem);
+
+ if(enable)
+ priv->highpower=1;
+ else
+ priv->highpower=0;
+
+ DMESG("Increasable transmission power %s",
+ priv->highpower ? "enabled" : "disabled");
+
+ if( (prev != priv->highpower) && !(priv->highpower) && (priv->chtxpwr[1] > priv->chtxpwr_orig[1]) )
+ {
+ for(i=1;i<15;i++)
+ {
+ priv->chtxpwr[i] = priv->chtxpwr_orig[i];
+ priv->chtxpwr_ofdm[i] = priv->chtxpwr_ofdm_orig[i];
+ }
+ rtl8225z2_SetTXPowerLevel(dev, 1);
+ wrqu->power.value = priv->txpwr_max;
+ }
+
+ up(&priv->wx_sem);
+
return 0;
}
static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_mode_rtl7(priv->ieee80211,a,wrqu,b);
+
rtl8187_set_rxconf(dev);
-
+
up(&priv->wx_sem);
return ret;
}
-static int rtl8180_wx_get_range(struct net_device *dev,
- struct iw_request_info *info,
+static int rtl8180_wx_get_range(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
struct iw_range *range = (struct iw_range *)extra;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u16 val;
int i;
@@ -186,26 +307,26 @@
/* Let's try to keep this struct in the same order as in
* linux/include/wireless.h
*/
-
+
/* TODO: See what values we can set, and remove the ones we can't
* set, or fill them with some default data.
*/
/* ~5 Mb/s real (802.11b) */
- range->throughput = 5 * 1000 * 1000;
+ range->throughput = 5 * 1000 * 1000;
// TODO: Not used in 802.11b?
// range->min_nwid; /* Minimal NWID we are able to set */
// TODO: Not used in 802.11b?
// range->max_nwid; /* Maximal NWID we are able to set */
-
+
/* Old Frequency (backward compat - moved lower ) */
-// range->old_num_channels;
+// range->old_num_channels;
// range->old_num_frequency;
// range->old_freq[6]; /* Filler to keep "version" at the same offset */
if(priv->rf_set_sens != NULL)
range->sensitivity = priv->max_sens; /* signal level threshold range */
-
+
range->max_qual.qual = 100;
/* TODO: Find real max RSSI and stick here */
range->max_qual.level = 0;
@@ -219,14 +340,14 @@
range->avg_qual.updated = 7; /* Updated all three */
range->num_bitrates = RATE_COUNT;
-
+
for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
range->bitrate[i] = rtl8180_rates[i];
}
-
+
range->min_frag = MIN_FRAG_THRESHOLD;
range->max_frag = MAX_FRAG_THRESHOLD;
-
+
range->pm_capa = 0;
range->we_version_compiled = WIRELESS_EXT;
@@ -243,18 +364,18 @@
range->num_channels = 14;
for (i = 0, val = 0; i < 14; i++) {
-
+
// Include only legal frequencies for some countries
if ((priv->challow)[i+1]) {
range->freq[val].i = i + 1;
- range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
+ range->freq[val].m = ieee80211_wlan_frequencies_rtl7[i] * 100000;
range->freq[val].e = 1;
val++;
} else {
// FIXME: do we need to set anything for channels
// we don't use ?
}
-
+
if (val == IW_MAX_FREQUENCIES)
break;
}
@@ -267,15 +388,15 @@
static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
@@ -286,50 +407,50 @@
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
if(!priv->up) return -1;
-
+
down(&priv->wx_sem);
- ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-
+ ret = ieee80211_wx_get_scan_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
-
+
return ret;
}
-static int r8180_wx_set_essid(struct net_device *dev,
+static int r8180_wx_set_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
int ret;
-
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
-
+
+ ret = ieee80211_wx_set_essid_rtl7(priv->ieee80211,a,wrqu,b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_essid(struct net_device *dev,
+static int r8180_wx_get_essid(struct net_device *dev,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
+
+ ret = ieee80211_wx_get_essid_rtl7(priv->ieee80211, a, wrqu, b);
up(&priv->wx_sem);
-
+
return ret;
}
@@ -338,30 +459,30 @@
union iwreq_data *wrqu, char *b)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-
+
+ ret = ieee80211_wx_set_freq_rtl7(priv->ieee80211, a, wrqu, b);
+
up(&priv->wx_sem);
return ret;
}
-static int r8180_wx_get_name(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_name(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ return ieee80211_wx_get_name_rtl7(priv->ieee80211, info, wrqu, extra);
}
-static int r8180_wx_set_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (wrqu->frag.disabled)
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
@@ -369,7 +490,7 @@
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
-
+
priv->ieee80211->fts = wrqu->frag.value & ~0x1;
}
@@ -377,11 +498,11 @@
}
-static int r8180_wx_get_frag(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_frag(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
wrqu->frag.value = priv->ieee80211->fts;
wrqu->frag.fixed = 0; /* no auto select */
@@ -397,49 +518,49 @@
char *extra)
{
int ret;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
down(&priv->wx_sem);
-
- ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
-
+
+ ret = ieee80211_wx_set_wap_rtl7(priv->ieee80211,info,awrq,extra);
+
up(&priv->wx_sem);
return ret;
-
+
}
-
-static int r8180_wx_get_wap(struct net_device *dev,
- struct iw_request_info *info,
+
+static int r8180_wx_get_wap(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_wap_rtl7(priv->ieee80211,info,wrqu,extra);
}
-static int r8180_wx_get_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ return ieee80211_wx_get_encode_rtl7(priv->ieee80211, info, wrqu, key);
}
-static int r8180_wx_set_enc(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_enc(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *key)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
DMESG("Setting SW wep key");
- ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
-
+ ret = ieee80211_wx_set_encode_rtl7(priv->ieee80211,info,wrqu,key);
+
up(&priv->wx_sem);
return ret;
}
@@ -447,28 +568,28 @@
static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
iwreq_data *wrqu, char *p){
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int *parms=(int*)p;
int mode=parms[0];
-
+
priv->ieee80211->active_scan = mode;
-
+
return 1;
}
-static int r8180_wx_set_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int err = 0;
-
+
down(&priv->wx_sem);
-
- if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
+
+ if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){
err = -EINVAL;
goto exit;
@@ -485,13 +606,13 @@
if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-
+
}else {
priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
}
-
- /* FIXME !
+
+ /* FIXME !
* We might try to write directly the TX config register
* or to restart just the (R)TX process.
* I'm unsure if whole reset is really needed
@@ -503,28 +624,28 @@
rtl8180_rtx_disable(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
-
+
}
*/
exit:
up(&priv->wx_sem);
-
+
return err;
}
-static int r8180_wx_get_retry(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_retry(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
wrqu->retry.disabled = 0; /* can't be disabled */
- if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
- IW_RETRY_LIFETIME)
+ if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+ IW_RETRY_LIFETIME)
return -EINVAL;
-
+
if (wrqu->retry.flags & IW_RETRY_MAX) {
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
wrqu->retry.value = priv->retry_rts;
@@ -533,30 +654,30 @@
wrqu->retry.value = priv->retry_data;
}
//DMESG("returning %d",wrqu->retry.value);
-
+
return 0;
}
-static int r8180_wx_get_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_get_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(priv->rf_set_sens == NULL)
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ if(priv->rf_set_sens == NULL)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
}
-static int r8180_wx_set_sens(struct net_device *dev,
- struct iw_request_info *info,
+static int r8180_wx_set_sens(struct net_device *dev,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
short err = 0;
down(&priv->wx_sem);
//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -571,7 +692,7 @@
exit:
up(&priv->wx_sem);
-
+
return err;
}
@@ -623,50 +744,55 @@
dummy, /* SIOCGIWRTS */
r8180_wx_set_frag, /* SIOCSIWFRAG */
r8180_wx_get_frag, /* SIOCGIWFRAG */
- dummy, /* SIOCSIWTXPOW */
- dummy, /* SIOCGIWTXPOW */
+ r8180_wx_set_txpow, /* SIOCSIWTXPOW */
+ r8180_wx_get_txpow, /* SIOCGIWTXPOW */
r8180_wx_set_retry, /* SIOCSIWRETRY */
r8180_wx_get_retry, /* SIOCGIWRETRY */
r8180_wx_set_enc, /* SIOCSIWENCODE */
r8180_wx_get_enc, /* SIOCGIWENCODE */
dummy, /* SIOCSIWPOWER */
dummy, /* SIOCGIWPOWER */
-};
+};
-static const struct iw_priv_args r8180_private_args[] = {
-
+static const struct iw_priv_args r8180_private_args[] = {
{
- SIOCIWFIRSTPRIV + 0x0,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
- },
-
+ SIOCIWFIRSTPRIV + 0x0,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "fasttx"
+ },
+
{
SIOCIWFIRSTPRIV + 0x1,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "highpower"
},
+
{
- SIOCIWFIRSTPRIV + 0x2,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
+ SIOCIWFIRSTPRIV + 0x2,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
+ },
+
+ {
+ SIOCIWFIRSTPRIV + 0x3,
+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
+
}
};
static iw_handler r8180_private_handler[] = {
-// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_fasttx, /* SIOCIWFIRSTPRIV */
+ r8180_wx_set_highpower, /*SIOCIWSECONDPRIV*/
r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/
// r8180_wx_set_forceassociate,
// r8180_wx_set_beaconinterval,
// r8180_wx_set_monitor_type,
r8180_wx_set_scan_type,
- r8180_wx_set_rawtx,
};
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
@@ -679,8 +805,8 @@
.private = r8180_private_handler,
.num_private = sizeof(r8180_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17
+#if WIRELESS_EXT >= 17
.get_wireless_stats = r8180_get_wireless_stats,
#endif
- .private_args = (struct iw_priv_args *)r8180_private_args,
+ .private_args = (struct iw_priv_args *)r8180_private_args,
};
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c 2006-06-22 07:43:30.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c 2008-02-15 00:37:05.000000000 +0100
@@ -1,27 +1,27 @@
/*
This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon.
Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
+
some ideas might be derived from David Young rtl8180 netbsd driver.
-
+
Parts of the usb code are from the r8150.c driver in linux kernel
-
+
Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
+
+ We (I?) want to thanks the Authors of those projecs and also the
Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
- - Please note that this file is a modified version from rtl8180-sa2400
+ A special big thanks goes also to Realtek corp. for their help in my
+ attempt to add RTL8187 and RTL8225 support, and to David Young also.
+
+ - Please note that this file is a modified version from rtl8180-sa2400
drv. So some other people have contributed to this project, and they are
thanked in the rtl8180-sa2400 CHANGELOG.
*/
@@ -57,6 +57,7 @@
#undef DEBUG_IRQ_TASKLET
#undef DEBUG_TX_ALLOC
#undef DEBUG_TX_DESC
+#undef DEBUG_TX_POWER
//#define CONFIG_RTL8180_IO_MAP
@@ -66,6 +67,9 @@
#include "r8180_93cx6.h" /* Card EEPROM */
#include "r8180_wx.h"
+#if !(defined(CONFIG_USB_EHCI_HCD) || defined (CONFIG_USB_EHCI_HCD_MODULE))
+ #error Build your kernel with ehci_hcd support!
+#endif
// FIXME: check if 2.6.7 is ok
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
@@ -98,6 +102,10 @@
#endif
static int channels = 0x3fff;
+// #define DEBUG_EPROM
+// #define DEBUG_REGISTERS
+// #define DEBUG_TX_POWER
+
MODULE_LICENSE("GPL");
MODULE_VERSION("V 1.1");
MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
@@ -137,7 +145,7 @@
static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id);
-
+
static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
static struct usb_driver rtl8187_usb_driver = {
@@ -158,13 +166,12 @@
#endif
};
-
void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -173,10 +180,10 @@
void write_nic_byte(struct net_device *dev, int indx, u8 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -185,10 +192,10 @@
void write_nic_word(struct net_device *dev, int indx, u16 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -197,23 +204,23 @@
void write_nic_dword(struct net_device *dev, int indx, u32 data)
{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
indx|0xff00, 0, &data, 4, HZ / 2);
}
-
-
-
+
+
+
u8 read_nic_byte(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 1, HZ / 2);
@@ -223,22 +230,22 @@
u8 read_nic_byte_E(struct net_device *dev, int indx)
{
u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xfe00, 0, &data, 1, HZ / 2);
return data;
}
-
+
u16 read_nic_word(struct net_device *dev, int indx)
{
u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 2, HZ / 2);
@@ -249,16 +256,16 @@
u32 read_nic_dword(struct net_device *dev, int indx)
{
u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
struct usb_device *udev = priv->udev;
-
+
usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
indx|0xff00, 0, &data, 4, HZ / 2);
return data;
}
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
+/* this might still called in what was the PHY rtl8185/rtl8187 common code
* plans are to possibilty turn it again in one common code...
*/
inline void force_pci_posting(struct net_device *dev)
@@ -271,7 +278,12 @@
//void set_nic_txring(struct net_device *dev);
static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work);
+#else
void rtl8180_restart(struct net_device *dev);
+#endif
/****************************************************************************
-----------------------------PROCFS STUFF-------------------------
@@ -284,13 +296,13 @@
int *eof, void *data)
{
struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
int i,n;
-
+
int max=0xff;
-
+
/* This dump the current register page */
for(n=0;n<=max;)
{
@@ -307,7 +319,7 @@
len += snprintf(page + len, count - len,"\n");
-
+
*eof = 1;
return len;
@@ -319,16 +331,16 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"NIC int: %lu\n"
"Total int: %lu\n",
priv->stats.ints,
priv->stats.shints);
-
+
*eof = 1;
return len;
}
@@ -339,10 +351,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"TX normal priority ok int: %lu\n"
"TX normal priority error int: %lu\n"
@@ -359,7 +371,7 @@
"TX HW queue: %d\n"
"TX lp dropped: %lu\n"
"TX np dropped: %lu\n"
- "TX total data packets %lu\n",
+ "TX total data packets %lu\n",
// "TX beacon aborted: %lu\n",
priv->stats.txnpokint,
priv->stats.txnperr,
@@ -379,10 +391,10 @@
priv->stats.txdatapkt
// priv->stats.txbeaconerr
);
-
+
*eof = 1;
return len;
-}
+}
@@ -391,10 +403,10 @@
int *eof, void *data)
{
struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
int len = 0;
-
+
len += snprintf(page + len, count - len,
"RX packets: %lu\n"
"RX urb status error: %lu\n"
@@ -402,35 +414,44 @@
priv->stats.rxok,
priv->stats.rxstaterr,
priv->stats.rxurberr);
-
+
*eof = 1;
return len;
-}
-
+}
+#if WIRELESS_EXT < 17
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
return &priv->wstats;
}
+#endif
void rtl8180_proc_module_init(void)
-{
+{
DMESG("Initializing proc filesystem");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
+#else
+ rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net);
+#endif
}
void rtl8180_proc_module_remove(void)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
+#else
+ remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net);
+#endif
}
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
if (priv->dir_dev) {
// remove_proc_entry("stats-hw", priv->dir_dev);
remove_proc_entry("stats-tx", priv->dir_dev);
@@ -447,9 +468,9 @@
void rtl8180_proc_init_one(struct net_device *dev)
{
struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ priv->dir_dev = create_proc_entry(dev->name,
+ S_IFDIR | S_IRUGO | S_IXUGO,
rtl8180_proc);
if (!priv->dir_dev) {
DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
@@ -459,7 +480,7 @@
#if 0
e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_hw, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-hw\n",
@@ -468,17 +489,17 @@
#endif
e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_rx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-rx\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_tx, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-tx\n",
@@ -487,27 +508,27 @@
#if 0
e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ieee, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ieee\n",
dev->name);
}
-
-
+
+
e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_stats_ap, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/stats-ap\n",
dev->name);
}
#endif
-
+
e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
priv->dir_dev, proc_get_registers, dev);
-
+
if (!e) {
DMESGE("Unable to initialize "
"/proc/net/rtl8187/%s/registers\n",
@@ -523,14 +544,14 @@
{
int i;
u8 *buf =(u8*)buffer;
-
+
printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%c",buf[i]);
-
+
printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
+
for(i=0;i<len;i++)
printk("%x",buf[i]);
@@ -539,17 +560,17 @@
short check_nic_enought_desc(struct net_device *dev, priority_t priority)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ int used = atomic_read((priority == NORM_PRIORITY) ?
&priv->tx_np_pending : &priv->tx_lp_pending);
-
+
return (used < MAX_TX_URB);
}
void tx_timeout(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//rtl8180_commit(dev);
schedule_work(&priv->reset_wq);
//DMESG("TXTIMEOUT");
@@ -561,7 +582,20 @@
{
int i;
for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
+ DMESG("EEPROM addr %02X : %04X", i, eprom_read(dev,i));
+}
+
+/* this is only for debug */
+void dump_tx_power(struct net_device *dev)
+{
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+ int i;
+ DMESG("CCK TX-Power (b-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr[i]);
+ DMESG("OFDM TX-Power (g-mode):");
+ for(i=1; i<=14; i++)
+ DMESG("Channel %d: %d", i, priv->chtxpwr_ofdm[i]);
}
/* this is only for debug */
@@ -570,14 +604,14 @@
int i;
int n;
int max=0xff;
-
- DMESG("Dumping NIC register map");
-
+
+ DMESG("Dumping NIC register map");
+
for(n=0;n<=max;)
{
- printk( "\nD: %2x> ", n);
+ printk( "\nD: %02X> ", n);
for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
+ printk("%02X ",read_nic_byte(dev,n));
}
printk("\n");
}
@@ -589,11 +623,11 @@
void rtl8180_irq_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
//priv->irq_enabled = 1;
/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
+ write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+ INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
*/
@@ -603,7 +637,7 @@
void rtl8180_irq_disable(struct net_device *dev)
{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
write_nic_word(dev,INTA_MASK,0);
force_pci_posting(dev);
@@ -625,115 +659,119 @@
void rtl8180_update_msr(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
u8 msr;
-
+
msr = read_nic_byte(dev, MSR);
msr &= ~ MSR_LINK_MASK;
-
+
/* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
+ * msr must be updated if the state is ASSOCIATING.
* this is intentional and make sense for ad-hoc and
* master (see the create BSS/IBSS func)
*/
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
+ if (priv->ieee80211->state == IEEE80211_LINKED){
+
if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
+
}else
msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
+
write_nic_byte(dev, MSR, msr);
}
void rtl8180_set_chan(struct net_device *dev,short ch)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 tx;
priv->chan=ch;
#if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
+
+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
+ rtl8180_update_beacon_ch(dev);
}
#endif
-
+
/* this hack should avoid frame TX during channel setting*/
tx = read_nic_dword(dev,TX_CONF);
tx &= ~TX_LOOPBACK_MASK;
-#ifndef LOOP_TEST
+#ifndef LOOP_TEST
write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
priv->rf_set_chan(dev,priv->chan);
mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
#endif
}
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
+#else
+void rtl8187_rx_isr(struct urb *rx_urb);
+#endif
void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int err;
-
+
// u8 *rx;
-
+
//DMESG("starting RX");
/*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
+ if(!rx){
DMESGE("unable to allocate RX buffer");
return;
}*/
-
+
usb_fill_bulk_urb(rx_urb,priv->udev,
usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
+ err = usb_submit_urb(rx_urb, GFP_ATOMIC);
if(err && err != -EPERM){
DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
+
}
-
+
}
void rtl8187_rx_initiate(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
if(!priv->rx_urb)
DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
+ for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
+
}
void rtl8187_set_rxconf(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u32 rxconf;
-
+
rxconf=read_nic_dword(dev,RX_CONF);
rxconf = rxconf &~ MAC_FILTER_MASK;
rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
+ rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
dev->flags & IFF_PROMISC){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
@@ -741,40 +779,40 @@
rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}
-
+
/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
}*/
-
+
if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
}
-
+
if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
+
+
rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
+
+
rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
+
rxconf = rxconf &~ MAX_RX_DMA_MASK;
rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
+
rxconf = rxconf | RCR_ONLYERLPKT;
-
+
// rxconf = rxconf &~ RCR_CS_MASK;
// rxconf = rxconf | (1<<RCR_CS_SHIFT);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
// V rtl suggested V //
// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
+
//fix_rx_fifo(dev);
// //set_nic_rxring(dev);
#ifdef DEBUG_RX
@@ -785,23 +823,23 @@
void rtl8180_rx_enable(struct net_device *dev)
{
u8 cmd;
-
-
+
+
rtl8187_rx_initiate(dev);
- rtl8187_set_rxconf(dev);
+ rtl8187_set_rxconf(dev);
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
+ /* In rtl8139 driver seems that DMA threshold has to be written
+ * after enabling RX, so we rewrite RX_CONFIG register
*/
//mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
+ write_nic_dword(dev, RX_CONF, rxconf);
+
#endif
-
+
}
@@ -810,37 +848,37 @@
u8 cmd;
u8 byte;
u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
byte = read_nic_byte(dev,CW_CONF);
byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
write_nic_byte(dev, CW_CONF, byte);
-
+
byte = read_nic_byte(dev, TX_AGC_CTL);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
write_nic_byte(dev, TX_AGC_CTL, byte);
-
+
txconf= read_nic_dword(dev,TX_CONF);
-
+
#if 0
if(priv->card_8185){
-
+
txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
+
}else{
-
- if(priv->ieee80211->hw_seq)
+
+ if(priv->ieee80211->hw_seq)
txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
+ else
txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
}
#endif
txconf = txconf &~ TX_LOOPBACK_MASK;
-
+
#ifndef LOOP_TEST
txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
#else
@@ -848,23 +886,26 @@
#endif
txconf = txconf &~ TCR_DPRETRY_MASK;
txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR)
+ {
+ txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
+ txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
+ }
+
txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
+
txconf = txconf &~ TCR_MXDMA_MASK;
txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
+
txconf = txconf | TCR_CWMIN;
txconf = txconf | TCR_DISCW;
txconf = txconf &~ TCR_SWPLCPLEN;
-
+
txconf=txconf | (1<<TX_NOICV_SHIFT);
-
+
write_nic_dword(dev,TX_CONF,txconf);
-
+
// V RTL suggested V //
// write_nic_dword(dev,TX_CONF,0x00e00707);
@@ -872,9 +913,9 @@
#ifdef DEBUG_TX
DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
#endif
-
+
cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
// mdelay(100);
//write_nic_dword(dev,TX_CONF,txconf);
@@ -889,18 +930,18 @@
#if 0
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
}
void rtl8180_
-_disable(struct net_device *dev)
+_disable(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -914,8 +955,8 @@
{
u8 cmd;
int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
cmd=read_nic_byte(dev,CMD);
write_nic_byte(dev, CMD, cmd &~ \
((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
@@ -926,9 +967,9 @@
usb_kill_urb(priv->rx_urb[i]);
}
/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
+ udelay(10);
*/
-
+
// if(!priv->rx_skb_complete)
// dev_kfree_skb_any(priv->rx_skb);
}
@@ -939,14 +980,14 @@
#if 0
int i;
u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
+ sizeof(u32)*8*count,
&priv->txbeaconringdma);
if (!priv->txbeaconring) return -1;
for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
/*
*(tmp+2) = (u32)dma_tmp;
*(tmp+3) = bufsize;
@@ -955,7 +996,7 @@
*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
else
*(tmp+4) = (u32)priv->txbeaconringdma;
-
+
tmp=tmp+8;
}
#endif
@@ -965,15 +1006,15 @@
void rtl8180_reset(struct net_device *dev)
{
-
+
u8 cr;
-
+
/* make sure the analog power is on before
* reset, otherwise reset may fail
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
rtl8180_irq_disable(dev);
mdelay(200);
@@ -981,19 +1022,19 @@
write_nic_byte_E(dev,0x18,0x11);
write_nic_byte_E(dev,0x18,0x00);
mdelay(200);
-
+
cr=read_nic_byte(dev,CMD);
cr = cr & 2;
cr = cr | (1<<CMD_RST_SHIFT);
write_nic_byte(dev,CMD,cr);
-
+
force_pci_posting(dev);
-
+
mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
+
+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
DMESGW("Card reset timeout!");
- else
+ else
DMESG("Card successfully reset");
rtl8180_set_mode(dev,EPROM_CMD_LOAD);
@@ -1005,13 +1046,13 @@
*/
rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
+
}
inline u16 ieeerate2rtlrate(int rate)
{
switch(rate){
- case 10:
+ case 10:
return 0;
case 20:
return 1;
@@ -1037,32 +1078,42 @@
return 11;
default:
return 3;
-
+
}
}
static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
inline u16 rtl8180_rate2rate(short rate)
{
if (rate >11) return 0;
- return rtl_rate[rate];
+ return rtl_rate[rate];
+}
+
+inline u8 rtl8180_IsWirelessBMode(u16 rate)
+{
+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
+ return 1;
+ else return 0;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
+#else
+void rtl8187_rx_isr(struct urb *rx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->rxurb_task = rx_urb;
// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
+ tasklet_schedule(&priv->irq_rx_tasklet);
// DMESGW("=David: Rx tasklet finish!");
}
#if 0
void rtl8180_tx_queues_stop(struct net_device *dev)
{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
@@ -1078,7 +1129,7 @@
{
//FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1091,7 +1142,7 @@
{
// FIXME !!
#if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
@@ -1105,14 +1156,19 @@
*/
void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
+ short morefrag = 0;
unsigned long flags;
struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->ieee80211->raw_tx != 1)
+ {
+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
+ {
+ morefrag = 1;
+ }
+ }
// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
/*
* This function doesn't require lock because we make
@@ -1121,24 +1177,29 @@
* the ieee stack, or from the try_wake_queue (again trought
* the ieee stack.
*/
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ if(priv->ieee80211->iw_mode != IW_MODE_MONITOR || priv->fasttx == 0)
+ {
+ spin_lock_irqsave(&priv->tx_lock,flags);
+ //DMESG("TX");
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
+ DMESG("Error: no TX slot ");
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ }
+ rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
+ ieeerate2rtlrate(rate));
+
+ priv->stats.txdatapkt++;
+
+ if (!check_nic_enought_desc(dev, LOW_PRIORITY))
+ ieee80211_stop_queue_rtl7(priv->ieee80211);
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+ }
+ else
+ {
+ rtl8180_tx_fast(dev, (u32*)skb->data, skb->len, ieeerate2rtlrate(rate));
+ }
+
}
#if 0
/* This is a rough attempt to TX a frame
@@ -1148,12 +1209,12 @@
*/
int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
int ret;
unsigned long flags;
-
+
spin_lock_irqsave(&priv->tx_lock,flags);
-
+
ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
/*
int i;
@@ -1163,9 +1224,9 @@
*/
priv->ieee80211->stats.tx_bytes+=skb->len;
priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
dev_kfree_skb_any(skb);
return ret;
}
@@ -1178,7 +1239,7 @@
u16 duration;
u16 drift;
*ext=0;
-
+
switch(rate){
case 0://1mbps
*ext=0;
@@ -1187,7 +1248,7 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 1://2mbps
*ext=0;
duration = ((len+4)<<4) /0x4;
@@ -1195,40 +1256,44 @@
if(drift ==0 ) break;
duration++;
break;
-
+
case 2: //5.5mbps
*ext=0;
duration = ((len+4)<<4) /0xb;
drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
break;
-
+
default:
- case 3://11mbps
+ case 3://11mbps
*ext=0;
duration = ((len+4)<<4) /0x16;
drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
+ if(drift ==0 )
break;
duration++;
- if(drift > 6)
+ if(drift > 6)
break;
*ext=1;
break;
}
-
+
return duration;
}
#endif
void rtl8180_try_wake_queue(struct net_device *dev, int pri);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txlpokint++;
else
@@ -1239,6 +1304,15 @@
rtl8180_try_wake_queue(dev,LOW_PRIORITY);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void rtl8187_lptx_isr_fast(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_lptx_isr_fast(struct urb *tx_urb)
+#endif
+{
+ kfree(tx_urb->transfer_buffer);
+ usb_free_urb(tx_urb);
+}
void rtl8187_beacon_stop(struct net_device *dev)
{
@@ -1249,55 +1323,55 @@
if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
+ write_nic_byte(dev, MSR, msr);
}
-
-
+
+
}
void rtl8187_net_update(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct ieee80211_network *net;
net = & priv->ieee80211->current_network;
-
-
+
+
write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
//for(i=0;i<ETH_ALEN;i++)
// write_nic_byte(dev,BSSID+i,net->bssid[i]);
rtl8180_update_msr(dev);
-
+
// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
+ write_nic_word(dev, AtimtrItv, 100);
write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
write_nic_word(dev, BcnIntTime, 100);
-
+
}
void rtl8187_beacon_tx(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sk_buff *skb;
int i = 0;
-
+
rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
+
+ skb = ieee80211_get_beacon_rtl7(priv->ieee80211);
+
+
+ if(!skb){
DMESG("not enought memory for allocating beacon");
return;
}
-
-#if 0
+
+#if 0
while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
msleep_interruptible_rtl(HZ/2);
if(i++ > 20){
@@ -1307,7 +1381,7 @@
}
#endif
write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
+
i=0;
//while(!read_nic_byte(dev,BQREQ & (1<<7)))
while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
@@ -1318,16 +1392,20 @@
return ;
}
}
-
+
rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
0, priv->ieee80211->basic_rate);
-
+
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
+#else
+void rtl8187_nptx_isr(struct urb *tx_urb)
+#endif
{
struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if(tx_urb->status == 0)
priv->stats.txnpokint++;
else
@@ -1339,10 +1417,10 @@
}
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB
*/
-
+
short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
short morefrag, short rate)
{
@@ -1352,12 +1430,12 @@
int pend ;
int status;
struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
+ pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
+ /* we are locked here so the two atomic_read and inc are executed without interleaves */
if( pend > MAX_TX_URB){
if(priority == NORM_PRIORITY)
priv->stats.txnpdrop++;
@@ -1365,52 +1443,38 @@
priv->stats.txlpdrop++;
return -1;
}
-
-
+
//tx = kmalloc((len + 4*3), GFP_ATOMIC);
urb_len = len + 4*3;
if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
+ urb_len += 1;
}
tx = kmalloc(urb_len, GFP_ATOMIC);
if(!tx) return -ENOMEM;
- //printk(KERN_WARNING "urb_len = %d\n", urb_len);
+ //printk(KERN_WARNING "urb_len = %d\n", urb_len);
tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
+
if(!tx_urb){
-
+
kfree(tx);
return -ENOMEM;
}
-
+
memcpy(tx+3,txbuf,len);
tx[0] = 0;
tx[0] |= len & 0xfff;
tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
+
if(morefrag) tx[0] |= (1<<17);
tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
tx[0] |= (rate << 24);
tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
// tx[2] = 0x303020;
tx[2] = 3; // CW min
tx[2] |= (7<<4); //CW max
tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
+
// printk("%x\n%x\n",tx[0],tx[1]);
#ifdef DUMP_TX
@@ -1421,7 +1485,7 @@
printk("---------------\n");
#endif
-
+
/* FIXME check what EP is for low/norm PRI */
usb_fill_bulk_urb(tx_urb,priv->udev,
usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
@@ -1438,54 +1502,97 @@
}
}
-
+/* This function do the real dirty work: it sends a TX command
+ * descriptor plus data URB (fast)
+ */
+
+short rtl8180_tx_fast(struct net_device *dev, u32* txbuf, int len, short rate)
+{
+ u32 *tx;
+ int status;
+ struct urb *tx_urb;
+ int urb_len;
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ urb_len = len + 4*3;
+ if((0 == urb_len%64)||(0 == urb_len%512)) {
+ urb_len += 1;
+ }
+ tx = kmalloc(urb_len, GFP_ATOMIC);
+ if(!tx) return -ENOMEM;
+
+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
+
+ if(!tx_urb){
+ kfree(tx);
+ return -ENOMEM;
+ }
+
+ memcpy(tx+3,txbuf,len);
+ tx[0] = (len & 0xfff) + 0x8000;
+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
+ tx[0] |= (rate << 24);
+ tx[1] = 0;
+ tx[2] = 2931;
+
+ /* FIXME check what EP is for low/norm PRI */
+ usb_fill_bulk_urb(tx_urb,priv->udev,
+ usb_sndbulkpipe(priv->udev, 2), tx, urb_len, rtl8187_lptx_isr_fast, dev);
+ status = usb_submit_urb(tx_urb, GFP_ATOMIC);
+ if (!status){
+ return 0;
+ }else{
+ return -1;
+ }
+}
+
void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
short rtl8187_usb_initendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
+
for(i=0;i<MAX_RX_URB;i++){
priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
+ if(!priv->rx_urb[i])
goto destroy;
-
+
priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
+ if(!priv->rx_urb[i]->transfer_buffer)
goto destroy1;
-
+
priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
}
-
+
return 0;
-
+
destroy1:
usb_free_urb(priv->rx_urb[i]);
-
+
destroy:
while (--i >= 0){
kfree(priv->rx_urb[i]->transfer_buffer);
usb_free_urb(priv->rx_urb[i]);
}
-
+
kfree(priv->rx_urb);
-
+
priv->rx_urb = NULL;
DMESGE("Endpoint Alloc Failure");
return -ENOMEM;
-
+
}
void rtl8187_usb_deleteendpoints(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i;
-
+
if(priv->rx_urb){
for(i=0;i<MAX_RX_URB;i++){
usb_kill_urb(priv->rx_urb[i]);
@@ -1494,9 +1601,9 @@
}
kfree(priv->rx_urb);
priv->rx_urb = NULL;
-
+
}
-
+
}
@@ -1505,16 +1612,16 @@
int i;
u16 word;
int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
+
+// struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
+ //if (ieee80211_is_54g_rtl7(priv->ieee80211->current_network) &&
// priv->ieee80211->state == IEEE80211_LINKED){
basic_rate = ieeerate2rtlrate(240);
min_rr_rate = ieeerate2rtlrate(60);
max_rr_rate = ieeerate2rtlrate(240);
-
-//
+
+//
// }else{
// basic_rate = ieeerate2rtlrate(20);
// min_rr_rate = ieeerate2rtlrate(10);
@@ -1526,21 +1633,21 @@
word = read_nic_word(dev, BRSR);
word &= ~BRSR_MBR_8185;
-
+
for(i=0;i<=basic_rate;i++)
word |= (1<<i);
write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
+ DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
}
void rtl8187_link_change(struct net_device *dev)
{
// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//write_nic_word(dev, BintrItv, net->beacon_interval);
rtl8187_net_update(dev);
/*update timing params*/
@@ -1553,24 +1660,24 @@
short rtl8180_init(struct net_device *dev)
{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
+
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int i, j;
u16 word;
- int ch;
+ int ch, chans;
//u16 version;
- //u8 hw_version;
- //u8 config3;
-
+ u8 hw_version;
+ u8 config3;
+
//FIXME: these constants are placed in a bad pleace.
// priv->txbuffsize = 1024;
// priv->txringcount = 32;
// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
+// priv->rxringcount = 32;
// priv->txbeaconcount = 3;
// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
+ //priv->txnp_pending.ispending=0;
/* ^^ the SKB does not containt a partial RXed
* packet (is empty)
*/
@@ -1580,15 +1687,24 @@
return -1;
}
ch=channels;
+ chans=0;
+ for (i=1; i<=14; i++) {
+ if( (u8)(ch & 0x01) ) chans++;
+ ch >>= 1;
+ }
+ DMESG("Enabling %d channels.", chans);
+ ch=channels;
// set channels 1..14 allowed in given locale
for (i=1; i<=14; i++) {
(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
ch >>= 1;
}
//memcpy(priv->stats,0,sizeof(struct Stats));
-
+
//priv->irq_enabled=0;
-
+
+ priv->dev = dev;
+
// priv->stats.rxdmafail=0;
priv->stats.txrdu=0;
// priv->stats.rxrdu=0;
@@ -1612,33 +1728,37 @@
// priv->stats.txbeaconerr=0;
priv->stats.txlperr=0;
priv->stats.txlpokint=0;
-
+
priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
+
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
+ priv->ieee80211->mode = IEEE_G|IEEE_B;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
spin_lock_init(&priv->tx_lock);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
+#else
+ INIT_WORK(&priv->reset_wq, rtl8180_restart);
+#endif
sema_init(&priv->wx_sem,1);
tasklet_init(&priv->irq_rx_tasklet,
(void(*)(unsigned long))rtl8180_irq_rx_tasklet,
(unsigned long)priv);
- //priv->ieee80211->func =
+ //priv->ieee80211->func =
// kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
//memset(priv->ieee80211->func, 0,
// sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
/*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
+
priv->ieee80211->active_scan = 1;
priv->ieee80211->rate = 110; //11 mbps
priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
@@ -1655,51 +1775,51 @@
priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
//priv->ieee80211->start_send_beacons = NULL;
//priv->ieee80211->stop_send_beacons = NULL;
-
+
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
+
priv->card_8185 = 2;
priv->phy_ver = 2;
priv->card_type = USB;
-
+
#if 0
hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
+
switch (hw_version){
case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
+ DMESG("MAC controller is a RTL8185 b/g");
priv->card_8185 = 1;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
+ DMESG("MAC controller is a RTL8185 b/g (V. D)");
priv->card_8185 = 2;
/* you should not find a card with 8225 PHY ver < C*/
priv->phy_ver = 2;
break;
-
+
case HW_VERID_R8180_ABCD:
DMESG("MAC controller is a RTL8180");
priv->card_8185 = 0;
break;
-
+
case HW_VERID_R8180_F:
DMESG("MAC controller is a RTL8180 (v. F)");
priv->card_8185 = 0;
break;
-
+
default:
DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
priv->card_8185 = 0;
break;
}
-
-
+
+
/* you should not found any 8185 Ver B Card */
priv->card_8185_Bversion = 0;
-
+
config3 = read_nic_byte(dev, CONFIG3);
if(config3 & 0x8){
priv->card_type = CARDBUS;
@@ -1715,13 +1835,19 @@
#endif
priv->enable_gpio0 = 0;
-
+
+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
+ config3 = read_nic_byte(dev, CONFIG3);
+
+ DMESG("MAC chip version: %02X", hw_version);
+ DMESG("Card type: %02X", config3);
+
/* commented out just because we already do
this when resetting the card
andrea 20050924
*/
#if 0
-
+
u8 txcr, txreg50;
u32 txreg54, txreg60;
@@ -1757,8 +1883,8 @@
// DMESG("<<txcr:%x>>", txcr);
#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
+
+ /*the eeprom type is stored in RCR register bit #6 */
if (RCR_9356SEL & read_nic_dword(dev, RCR)){
priv->epromtype=EPROM_93c56;
DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
@@ -1766,58 +1892,73 @@
priv->epromtype=EPROM_93c46;
DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
}
-
+
dev->get_stats = rtl8180_stats;
-
+
dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
+
DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
+
for(i=1,j=0; i<6; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW0 + j);
priv->chtxpwr[i]=word & 0xf;
priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
priv->chtxpwr[i+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW1 + j);
priv->chtxpwr[i+6]=word & 0xf;
priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
}
-
+
for(i=1,j=0; i<4; i+=2,j++){
-
+
word = eprom_read(dev,EPROM_TXPW2 + j);
priv->chtxpwr[i+6+4]=word & 0xf;
priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
}
-
-
+
+
priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
+
+#ifdef DEBUG_TX_POWER
+ dump_tx_power(dev);
+#endif
+
+ DMESG("RF Chip ID: %02X", priv->rf_chip);
+
word = eprom_read(dev,EPROM_TXPW_BASE);
priv->cck_txpwr_base = word & 0xf;
priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
+
+ priv->txpwr_max = 0;
+ for(i=1; i<15; i++)
+ {
+ if(priv->chtxpwr[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr[i];
+ if(priv->chtxpwr_ofdm[i] > priv->txpwr_max) priv->txpwr_max = priv->chtxpwr_ofdm[i];
+ priv->chtxpwr_orig[i] = priv->chtxpwr[i];
+ priv->chtxpwr_ofdm_orig[i] = priv->chtxpwr_ofdm[i];
+ }
+
/* check RF frontend chipset */
-
+
switch (priv->rf_chip) {
-
+
case EPROM_RFCHIPID_RTL8225U:
-
+
DMESG("Card reports RF frontend Realtek 8225");
DMESGW("This driver has EXPERIMENTAL support for this chipset.");
DMESGW("use it with care and at your own risk and");
@@ -1834,28 +1975,28 @@
DMESG("This seems a legacy 1st version radio");
}
priv->rf_close = rtl8225_rf_close;
-
+
priv->max_sens = RTL8225_RF_MAX_SENS;
priv->sens = RTL8225_RF_DEF_SENS;
break;
-
+
default:
DMESGW("Unknown RF module %x",priv->rf_chip);
DMESGW("Exiting...");
return -1;
-
+
}
-
+
// DMESG("Energy threshold: %x",priv->cs_treshold);
DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
//DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
+
+ if(rtl8187_usb_initendpoints(dev)!=0){
DMESG("Endopoints initialization failed");
return -ENOMEM;
}
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
+#if 0
+ if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
return -ENOMEM;
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
@@ -1869,16 +2010,16 @@
if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
TX_LOWPRIORITY_RING_ADDR))
return -ENOMEM;
-
-
+
+
if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
return -ENOMEM;
#endif
-
+
#ifdef DEBUG_EPROM
dump_eprom(dev);
-#endif
+#endif
return 0;
}
@@ -1898,7 +2039,7 @@
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
write_nic_dword(dev, ANAPARAM2, a);
@@ -1918,23 +2059,23 @@
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
+
write_nic_dword(dev, ANAPARAM, a);
conf3 = read_nic_byte(dev, CONFIG3);
write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
}
void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
{
- write_nic_byte(dev, TX_ANTENNA, ant);
+ write_nic_byte(dev, TX_ANTENNA, ant);
force_pci_posting(dev);
mdelay(1);
-}
+}
void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
@@ -1942,26 +2083,26 @@
//u8 phyr;
u32 phyw;
// int i;
-
+
adr |= 0x80;
-
+
phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
+
+
+
+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
//read_nic_dword(dev, PHY_ADR);
-#if 0
+#if 0
for(i=0;i<10;i++){
write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
phyr = read_nic_byte(dev, PHY_READ);
if(phyr == (data&0xff)) break;
-
+
}
#endif
/* this is ok to fail when we write AGC table. check for AGC table might be
@@ -1988,60 +2129,60 @@
void rtl8180_adapter_start(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
//u32 anaparam;
//u8 config3;
-
+
//rtl8180_rtx_disable(dev);
rtl8180_reset(dev);
write_nic_byte(dev,0x85,0);
write_nic_byte(dev,0x91,0);
-
+
/* light blink! */
write_nic_byte(dev,0x85,4);
write_nic_byte(dev,0x91,1);
write_nic_byte(dev,0x90,0);
-
+
priv->irq_mask = 0xffff;
/*
priv->dma_poll_mask = 0;
priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
+*/
// rtl8180_beacon_tx_disable(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
rtl8180_update_msr(dev);
-
+
rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
+
write_nic_word(dev,0xf4,0xffff);
write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
+
+ write_nic_dword(dev,INT_TIMEOUT,0);
#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
+ rtl8180_dump_reg(dev);
#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
+
+
+ write_nic_byte(dev, WPA_CONFIG, 0);
write_nic_byte(dev, RATE_FALLBACK, 0x81);
rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
+
+ priv->rf_init(dev);
if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
+ priv->rf_set_sens(dev,priv->sens);
+
write_nic_word(dev,0x5e,1);
#if 1
@@ -2054,13 +2195,13 @@
write_nic_byte(dev, 0xff, 0x60);
write_nic_word(dev,0x5e,0);
-
-
+
+
rtl8180_irq_enable(dev);
/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
+
DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
+
DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
@@ -2077,8 +2218,8 @@
void rtl8180_start_tx_beacon(struct net_device *dev)
{
int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ u16 word;
DMESG("Enabling beacon TX");
//write_nic_byte(dev, 0x42,0xe6);// TCR
//rtl8180_init_beacon(dev);
@@ -2091,41 +2232,41 @@
//write_nic_word(dev,0x7a,0);
//write_nic_word(dev,0x7a,0x8000);
-
+
word = read_nic_word(dev, BcnItv);
word &= ~BcnItv_BcnItv; // clear Bcn_Itv
write_nic_word(dev, BcnItv, word);
- write_nic_word(dev, AtimWnd,
+ write_nic_word(dev, AtimWnd,
read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
+
word = read_nic_word(dev, BintrItv);
word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
+
+ //word |= priv->ieee80211->beacon_interval *
// ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
+
write_nic_word(dev, BintrItv, word);
-
+
//write_nic_word(dev,0x2e,0xe002);
//write_nic_dword(dev,0x30,0xb8c7832e);
for(i=0; i<ETH_ALEN; i++)
write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
+
// rtl8180_update_msr(dev);
-
+
//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
+
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
+
rtl8180_irq_enable(dev);
-
+
/* VV !!!!!!!!!! VV*/
/*
rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
+ write_nic_byte(dev,0x9d,0x00);
rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
*/
}
@@ -2135,137 +2276,138 @@
***************************************************************************/
static struct net_device_stats *rtl8180_stats(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+
return &priv->ieee80211->stats;
}
int _rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
priv->up=1;
-
- //DMESG("Bringing up iface");
+
+// DMESG("Bringing up iface");
rtl8180_adapter_start(dev);
-
rtl8180_rx_enable(dev);
-
rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
+ ieee80211_softmac_start_protocol_rtl7(priv->ieee80211);
+ ieee80211_reset_queue_rtl7(priv->ieee80211);
if(!netif_queue_stopped(dev))
netif_start_queue(dev);
else
netif_wake_queue(dev);
-
return 0;
}
int rtl8180_open(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
+
ret = rtl8180_up(dev);
up(&priv->wx_sem);
return ret;
-
+
}
int rtl8180_up(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 1) return -1;
-
+
return _rtl8180_up(dev);
}
int rtl8180_close(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
int ret;
-
+
down(&priv->wx_sem);
-
+
ret = rtl8180_down(dev);
-
+
up(&priv->wx_sem);
-
+
return ret;
}
int rtl8180_down(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return -1;
-
+
priv->up=0;
/* FIXME */
if (!netif_queue_stopped(dev))
netif_stop_queue(dev);
-
+
rtl8180_rtx_disable(dev);
rtl8180_irq_disable(dev);
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
return 0;
}
void rtl8180_commit(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
+
+ ieee80211_softmac_stop_protocol_rtl7(priv->ieee80211);
+
rtl8180_irq_disable(dev);
rtl8180_rtx_disable(dev);
_rtl8180_up(dev);
}
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void rtl8180_restart(struct work_struct *work)
+{
+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
+ struct net_device *dev = priv->dev;
+#else
void rtl8180_restart(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
+#endif
down(&priv->wx_sem);
-
rtl8180_commit(dev);
-
+
up(&priv->wx_sem);
}
static void r8180_set_multicast(struct net_device *dev)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
short promisc;
//down(&priv->wx_sem);
-
+
/* FIXME FIXME */
-
+
promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
+
if (promisc != priv->promisc)
// rtl8180_commit(dev);
-
+
priv->promisc = promisc;
-
+
//schedule_work(&priv->reset_wq);
//up(&priv->wx_sem);
}
@@ -2273,17 +2415,17 @@
int r8180_set_mac_adr(struct net_device *dev, void *mac)
{
- struct r8180_priv *priv = ieee80211_priv(dev);
+ struct r8180_priv *priv = ieee80211_priv_rtl7(dev);
struct sockaddr *addr = mac;
-
+
down(&priv->wx_sem);
-
+
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
+
schedule_work(&priv->reset_wq);
-
+
up(&priv->wx_sem);
-
+
return 0;
}
@@ -2291,16 +2433,18 @@
/* based on ipw2200 driver */
int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+ struct iwreq *wrq;
+ int ret;
+
down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
+
+ wrq = (struct iwreq *)rq;
+
+ ret=-1;
switch (cmd) {
case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
+ ret = ieee80211_wpa_supplicant_ioctl_rtl7(priv->ieee80211, &wrq->u.data);
break;
default:
@@ -2309,7 +2453,7 @@
}
up(&priv->wx_sem);
-
+
return ret;
}
@@ -2320,10 +2464,11 @@
struct net_device *dev = (struct net_device*)rx_urb->context;
int status,len,flen;
struct sk_buff *skb;
- u32 *desc;
-
+ u8 *desc;
+ u8 signal,quality,rate;
+
//DMESG("rtl8187_rx_isr");
-
+
struct ieee80211_rx_stats stats = {
.signal = 0,
.noise = -98,
@@ -2332,43 +2477,109 @@
.freq = IEEE80211_24GHZ_BAND,
};
+
//DMESG("RX %d ",rx_urb->status);
status = rx_urb->status;
if(status == 0){
-
+
len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
+ // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
len -= 4*4;/* 4 dword and 4 byte CRC */
-
+#if 0
desc = (u32*)(rx_urb->transfer_buffer + len);
-
+
flen = desc[0] & 0xfff;
-
+
if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
+
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[1]& (0xff0000))>>16;
+ signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=(desc[1] & (0xff));
+
+ rate=(desc[0] &((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
stats.mac_time[0] = desc[2];
stats.mac_time[1] = desc[3];
+#endif
+
+ desc = rx_urb->transfer_buffer + len;
+
+ flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
+
+ if( flen <= rx_urb->actual_length){
+ //stats.signal = (desc[1] & 0x7f00)>>8;
+ //stats.noise = desc[1] &0xff;
+ signal=(desc[6]& 0xfe)>>1;
+ //signal=(signal&0xfe)>>1; // Modify by hikaru 6.6
+
+ quality=desc[4] & 0xff;
+
+ //rate=(desc[2] &((1<<7)|(1<<6)|(1<<5)|(1<<4)))>>4;
+ rate=(desc[2] & 0xf0)>>4;
+ // printk(KERN_INFO "rate is %d!\n",rate);
+ stats.rate = rtl8180_rate2rate(rate);
+ // printk(KERN_INFO "stats.rate is %d!\n",stats.rate);
+ //stats.rate = desc[0] >> 20 & 0xf;
+ stats.mac_time[0] = desc[8] + (desc[9]<<8) + (desc[10]<<16) + (desc[11]<<24);
+ stats.mac_time[1] = desc[12] + (desc[13]<<8) + (desc[14]<<16) + (desc[15]<<24);
+
+
+ //calculate link quality begin
+ if(!rtl8180_IsWirelessBMode(stats.rate) )
+ { // OFDM rate.
+ if(signal>90)
+ signal=90;
+ else if(signal<25)
+ signal=25;
+ signal = (90-signal)*100/65;
+ }
+ else
+ { // CCK rate.
+ if(signal>95)
+ signal = 95;
+ else if(signal<30)
+ signal = 30;
+ signal =(95-signal )*100/65;
+ }
+ priv->wstats.qual.level = signal;
+ // printk(KERN_INFO "signal is %d!\n",signal);
+ if(quality > 64)
+ priv ->wstats.qual.qual = 0;
+ else
+ priv ->wstats.qual.qual = ((64-quality) * 100) / 64; // SQ value is the SIGNAL_QUALITY returned to IORequest,
+ //and this value only appear when STA is associated to AP or
+ // STA is in IBSS mode
+ // printk(KERN_INFO "quality is %d!\n",priv->wstats.qual.qual);
+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual;
+ priv->wstats.qual.updated = 7;
+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR)
+ {
+ stats.signal = priv->wstats.qual.level;
+ stats.noise = priv->wstats.qual.noise;
+ }
+ //calculate link quality end
skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
+ if(skb){
memcpy(skb_put(skb,flen-4),
rx_urb->transfer_buffer,flen -4);
-
+
#ifdef DUMP_RX
int i;
for(i=0;i<flen-4;i++)
printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
printk("------RATE %x:w---------------\n",stats.rate);
-
+
#endif
priv->stats.rxok++;
// priv->rxskb = skb;
// priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
+ if(!ieee80211_rx_rtl7(priv->ieee80211,
skb, &stats))
dev_kfree_skb_any(skb);
}
@@ -2376,9 +2587,8 @@
}else{
priv->stats.rxstaterr++;
priv->ieee80211->stats.rx_errors++;
-
}
-
+
if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
else DMESG("RX process aborted due to explicit shutdown");
}
@@ -2396,20 +2606,22 @@
struct r8180_priv *priv= NULL;
struct usb_device *udev = interface_to_usbdev(intf);
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
+//printk("===> rtl8187_usb_probe()\n");
+
+ dev = alloc_ieee80211_rtl7(sizeof(struct r8180_priv));
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
+#endif
+ usb_set_intfdata(intf, dev);
+
SET_NETDEV_DEV(dev, &intf->dev);
- priv = ieee80211_priv(dev);
+ priv = ieee80211_priv_rtl7(dev);
priv->ieee80211 = netdev_priv(dev);
-
+
priv->udev=udev;
-
+
dev->open = rtl8180_open;
dev->stop = rtl8180_close;
//dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
@@ -2418,41 +2630,46 @@
dev->do_ioctl = rtl8180_ioctl;
dev->set_multicast_list = r8180_set_multicast;
dev->set_mac_address = r8180_set_mac_adr;
+#if WIRELESS_EXT >= 12
+#if WIRELESS_EXT < 17
dev->get_wireless_stats = r8180_get_wireless_stats;
+#endif
+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def;
+#endif
dev->type=ARPHRD_ETHER;
-
+
if (dev_alloc_name(dev, ifname) < 0){
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
ifname = "wlan%d";
dev_alloc_name(dev, ifname);
}
-
+
// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
+
+ if(rtl8180_init(dev)!=0){
DMESG("Initialization failed");
goto fail;
}
-
+
netif_carrier_off(dev);
netif_stop_queue(dev);
-
+
register_netdev(dev);
-
+
rtl8180_proc_init_one(dev);
-
-
+
+
DMESG("Driver probe completed\n");
- return 0;
+ return 0;
+
-
fail:
- free_ieee80211(dev);
-
+ free_ieee80211_rtl7(dev);
+
DMESG("wlan driver load failed\n");
-
+
return -ENODEV;
-
+
}
@@ -2461,13 +2678,13 @@
struct r8180_priv *priv;
struct net_device *dev = usb_get_intfdata(intf);
if(dev){
-
+
unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
+
+ priv=ieee80211_priv_rtl7(dev);
+
rtl8180_proc_remove_one(dev);
-
+
rtl8180_down(dev);
priv->rf_close(dev);
//rtl8180_rtx_disable(dev);
@@ -2478,12 +2695,12 @@
}
// pci_disable_device(pdev);
- free_ieee80211(dev);
+ free_ieee80211_rtl7(dev);
DMESG("wlan driver removed\n");
}
-static int __init rtl8187_usb_module_init(void)
+static int __init rtl8187_usb_module_init_rtl7(void)
{
printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
based WLAN cards\n");
@@ -2495,7 +2712,7 @@
}
-static void __exit rtl8187_usb_module_exit(void)
+static void __exit rtl8187_usb_module_exit_rtl7(void)
{
usb_deregister(&rtl8187_usb_driver);
@@ -2508,14 +2725,14 @@
{
unsigned long flags;
short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv_rtl7(dev);
+
spin_lock_irqsave(&priv->tx_lock,flags);
enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+ spin_unlock_irqrestore(&priv->tx_lock,flags);
+
if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
+ ieee80211_wake_queue_rtl7(priv->ieee80211);
}
@@ -2523,5 +2740,5 @@
/***************************************************************************
------------------- module init / exit stubs ----------------
****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
+module_init(rtl8187_usb_module_init_rtl7);
+module_exit(rtl8187_usb_module_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187_core.c~ 2006-06-22 07:40:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.c~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,2527 +0,0 @@
-/*
- This is part of rtl8187 OpenSource driver - v 0.1
- Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it>
- Released under the terms of GPL (General Public License)
-
-
- Parts of this driver are based on the rtl8180 driver skeleton
- from Patric Schenke & Andres Salomon.
-
- Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers.
-
- some ideas might be derived from David Young rtl8180 netbsd driver.
-
- Parts of the usb code are from the r8150.c driver in linux kernel
-
- Some ideas borrowed from the 8139too.c driver included in linux kernel.
-
- We (I?) want to thanks the Authors of those projecs and also the
- Ndiswrapper's project Authors.
-
- A special big thanks goes also to Realtek corp. for their help in my
- attempt to add RTL8187 and RTL8225 support, and to David Young also.
-
- - Please note that this file is a modified version from rtl8180-sa2400
- drv. So some other people have contributed to this project, and they are
- thanked in the rtl8180-sa2400 CHANGELOG.
-*/
-
-#ifndef CONFIG_FORCE_HARD_FLOAT
-double __floatsidf (int i) { return i; }
-unsigned int __fixunsdfsi (double d) { return d; }
-double __adddf3(double a, double b) { return a+b; }
-double __addsf3(float a, float b) { return a+b; }
-double __subdf3(double a, double b) { return a-b; }
-double __extendsfdf2(float a) {return a;}
-#endif
-
-#undef LOOP_TEST
-#undef DUMP_RX
-#undef DUMP_TX
-#undef DEBUG_TX_DESC2
-#undef RX_DONT_PASS_UL
-#undef DEBUG_EPROM
-#undef DEBUG_RX_VERBOSE
-#undef DUMMY_RX
-#undef DEBUG_ZERO_RX
-#undef DEBUG_RX_SKB
-#undef DEBUG_TX_FRAG
-#undef DEBUG_RX_FRAG
-#undef DEBUG_TX_FILLDESC
-#undef DEBUG_TX
-#undef DEBUG_IRQ
-#undef DEBUG_RX
-#undef DEBUG_RXALLOC
-#undef DEBUG_REGISTERS
-#undef DEBUG_RING
-#undef DEBUG_IRQ_TASKLET
-#undef DEBUG_TX_ALLOC
-#undef DEBUG_TX_DESC
-
-//#define CONFIG_RTL8180_IO_MAP
-
-#include "r8180_hw.h"
-#include "r8187.h"
-#include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
-#include "r8180_93cx6.h" /* Card EEPROM */
-#include "r8180_wx.h"
-
-
-// FIXME: check if 2.6.7 is ok
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
-#define usb_kill_urb usb_unlink_urb
-#endif
-
-#ifdef CONFIG_RTL8180_PM
-#include "r8180_pm.h"
-#endif
-
-#ifndef USB_VENDOR_ID_REALTEK
-#define USB_VENDOR_ID_REALTEK 0x0bda
-#endif
-#ifndef USB_VENDOR_ID_NETGEAR
-#define USB_VENDOR_ID_NETGEAR 0x0846
-#endif
-
-static struct usb_device_id rtl8187_usb_id_tbl[] = {
- {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)},
- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)},
- {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6a00)},
-
- {}
-};
-
-static char* ifname = "wlan%d";
-#if 0
-static int hwseqnum = 0;
-static int hwwep = 0;
-#endif
-static int channels = 0x3fff;
-
-MODULE_LICENSE("GPL");
-MODULE_VERSION("V 1.1");
-MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl);
-MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
-MODULE_DESCRIPTION("Linux driver for Realtek RTL8187 WiFi cards");
-
-#if 0
-MODULE_PARM(ifname,"s");
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-
-MODULE_PARM(hwseqnum,"i");
-MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-
-MODULE_PARM(hwwep,"i");
-MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-
-MODULE_PARM(channels,"i");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
-module_param(ifname, charp, S_IRUGO|S_IWUSR );
-//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
-//module_param(hwwep,int, S_IRUGO|S_IWUSR);
-module_param(channels,int, S_IRUGO|S_IWUSR);
-#else
-MODULE_PARM(ifname, "s");
-//MODULE_PARM(hwseqnum,"i");
-//MODULE_PARM(hwwep,"i");
-MODULE_PARM(channels,"i");
-#endif
-
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-//MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-
-static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id);
-
-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf);
-
-static struct usb_driver rtl8187_usb_driver = {
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
- .owner = THIS_MODULE,
-#endif
- .name = RTL8187_MODULE_NAME, /* Driver name */
- .id_table = rtl8187_usb_id_tbl, /* PCI_ID table */
- .probe = rtl8187_usb_probe, /* probe fn */
- .disconnect = rtl8187_usb_disconnect, /* remove fn */
-#ifdef CONFIG_RTL8180_PM
- .suspend = rtl8180_suspend, /* PM suspend fn */
- .resume = rtl8180_resume, /* PM resume fn */
-#else
- .suspend = NULL, /* PM suspend fn */
- .resume = NULL, /* PM resume fn */
-#endif
-};
-
-
-void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xfe00, 0, &data, 1, HZ / 2);
-}
-
-
-void write_nic_byte(struct net_device *dev, int indx, u8 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 1, HZ / 2);
-}
-
-
-void write_nic_word(struct net_device *dev, int indx, u16 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 2, HZ / 2);
-}
-
-
-void write_nic_dword(struct net_device *dev, int indx, u32 data)
-{
-
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx|0xff00, 0, &data, 4, HZ / 2);
-}
-
-
-
-u8 read_nic_byte(struct net_device *dev, int indx)
-{
- u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 1, HZ / 2);
- return data;
-}
-
-u8 read_nic_byte_E(struct net_device *dev, int indx)
-{
- u8 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xfe00, 0, &data, 1, HZ / 2);
- return data;
-}
-
-
-u16 read_nic_word(struct net_device *dev, int indx)
-{
- u16 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 2, HZ / 2);
- return data;
-}
-
-
-u32 read_nic_dword(struct net_device *dev, int indx)
-{
- u32 data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- struct usb_device *udev = priv->udev;
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx|0xff00, 0, &data, 4, HZ / 2);
- return data;
-}
-
-/* this might still called in what was the PHY rtl8185/rtl8187 common code
- * plans are to possibilty turn it again in one common code...
- */
-inline void force_pci_posting(struct net_device *dev)
-{
-}
-
-
-//irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs);
-//void set_nic_rxring(struct net_device *dev);
-//void set_nic_txring(struct net_device *dev);
-static struct net_device_stats *rtl8180_stats(struct net_device *dev);
-void rtl8180_commit(struct net_device *dev);
-void rtl8180_restart(struct net_device *dev);
-
-/****************************************************************************
- -----------------------------PROCFS STUFF-------------------------
-*****************************************************************************/
-
-static struct proc_dir_entry *rtl8180_proc = NULL;
-
-static int proc_get_registers(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
- int i,n;
-
- int max=0xff;
-
- /* This dump the current register page */
- for(n=0;n<=max;)
- {
- //printk( "\nD: %2x> ", n);
- len += snprintf(page + len, count - len,
- "\nD: %2x > ",n);
-
- for(i=0;i<16 && n<=max;i++,n++)
- len += snprintf(page + len, count - len,
- "%2x ",read_nic_byte(dev,n));
-
- // printk("%2x ",read_nic_byte(dev,n));
- }
- len += snprintf(page + len, count - len,"\n");
-
-
-
- *eof = 1;
- return len;
-
-}
-
-#if 0
-static int proc_get_stats_hw(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "NIC int: %lu\n"
- "Total int: %lu\n",
- priv->stats.ints,
- priv->stats.shints);
-
- *eof = 1;
- return len;
-}
-#endif
-
-static int proc_get_stats_tx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "TX normal priority ok int: %lu\n"
- "TX normal priority error int: %lu\n"
-// "TX high priority ok int: %lu\n"
-// "TX high priority failed error int: %lu\n"
- "TX low priority ok int: %lu\n"
- "TX low priority failed error int: %lu\n"
- "TX queue resume: %lu\n"
- "TX queue stopped?: %d\n"
- "TX fifo overflow: %lu\n"
-// "TX beacon: %lu\n"
- "TX lp queue: %d\n"
- "TX np queue: %d\n"
- "TX HW queue: %d\n"
- "TX lp dropped: %lu\n"
- "TX np dropped: %lu\n"
- "TX total data packets %lu\n",
-// "TX beacon aborted: %lu\n",
- priv->stats.txnpokint,
- priv->stats.txnperr,
-// priv->stats.txhpokint,
-// priv->stats.txhperr,
- priv->stats.txlpokint,
- priv->stats.txlperr,
- priv->stats.txresumed,
- netif_queue_stopped(dev),
- priv->stats.txoverflow,
-// priv->stats.txbeacon,
- atomic_read(&(priv->tx_lp_pending)),
- atomic_read(&(priv->tx_np_pending)),
- read_nic_byte(dev, TXFIFOCOUNT),
- priv->stats.txlpdrop,
- priv->stats.txnpdrop,
- priv->stats.txdatapkt
-// priv->stats.txbeaconerr
- );
-
- *eof = 1;
- return len;
-}
-
-
-
-static int proc_get_stats_rx(char *page, char **start,
- off_t offset, int count,
- int *eof, void *data)
-{
- struct net_device *dev = data;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- int len = 0;
-
- len += snprintf(page + len, count - len,
- "RX packets: %lu\n"
- "RX urb status error: %lu\n"
- "RX invalid urb error: %lu\n",
- priv->stats.rxok,
- priv->stats.rxstaterr,
- priv->stats.rxurberr);
-
- *eof = 1;
- return len;
-}
-
-
-static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return &priv->wstats;
-}
-
-void rtl8180_proc_module_init(void)
-{
- DMESG("Initializing proc filesystem");
- rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net);
-}
-
-
-void rtl8180_proc_module_remove(void)
-{
- remove_proc_entry(RTL8187_MODULE_NAME, proc_net);
-}
-
-
-void rtl8180_proc_remove_one(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- if (priv->dir_dev) {
- // remove_proc_entry("stats-hw", priv->dir_dev);
- remove_proc_entry("stats-tx", priv->dir_dev);
- remove_proc_entry("stats-rx", priv->dir_dev);
- // remove_proc_entry("stats-ieee", priv->dir_dev);
- // remove_proc_entry("stats-ap", priv->dir_dev);
- remove_proc_entry("registers", priv->dir_dev);
- remove_proc_entry(dev->name, rtl8180_proc);
- priv->dir_dev = NULL;
- }
-}
-
-
-void rtl8180_proc_init_one(struct net_device *dev)
-{
- struct proc_dir_entry *e;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dir_dev = create_proc_entry(dev->name,
- S_IFDIR | S_IRUGO | S_IXUGO,
- rtl8180_proc);
- if (!priv->dir_dev) {
- DMESGE("Unable to initialize /proc/net/rtl8187/%s\n",
- dev->name);
- return;
- }
- #if 0
- e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_hw, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-hw\n",
- dev->name);
- }
- #endif
- e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_rx, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-rx\n",
- dev->name);
- }
-
-
- e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_tx, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-tx\n",
- dev->name);
- }
- #if 0
- e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ieee, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-ieee\n",
- dev->name);
- }
-
-
- e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_stats_ap, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/stats-ap\n",
- dev->name);
- }
- #endif
-
- e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
- priv->dir_dev, proc_get_registers, dev);
-
- if (!e) {
- DMESGE("Unable to initialize "
- "/proc/net/rtl8187/%s/registers\n",
- dev->name);
- }
-}
-/****************************************************************************
- -----------------------------MISC STUFF-------------------------
-*****************************************************************************/
-
-/* this is only for debugging */
-void print_buffer(u32 *buffer, int len)
-{
- int i;
- u8 *buf =(u8*)buffer;
-
- printk("ASCII BUFFER DUMP (len: %x):\n",len);
-
- for(i=0;i<len;i++)
- printk("%c",buf[i]);
-
- printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-
- for(i=0;i<len;i++)
- printk("%x",buf[i]);
-
- printk("\n");
-}
-
-short check_nic_enought_desc(struct net_device *dev, priority_t priority)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- int used = atomic_read((priority == NORM_PRIORITY) ?
- &priv->tx_np_pending : &priv->tx_lp_pending);
-
- return (used < MAX_TX_URB);
-}
-
-void tx_timeout(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- //rtl8180_commit(dev);
- schedule_work(&priv->reset_wq);
- //DMESG("TXTIMEOUT");
-}
-
-
-/* this is only for debug */
-void dump_eprom(struct net_device *dev)
-{
- int i;
- for(i=0; i<63; i++)
- DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
-}
-
-/* this is only for debug */
-void rtl8180_dump_reg(struct net_device *dev)
-{
- int i;
- int n;
- int max=0xff;
-
- DMESG("Dumping NIC register map");
-
- for(n=0;n<=max;)
- {
- printk( "\nD: %2x> ", n);
- for(i=0;i<16 && n<=max;i++,n++)
- printk("%2x ",read_nic_byte(dev,n));
- }
- printk("\n");
-}
-
-/****************************************************************************
- ------------------------------HW STUFF---------------------------
-*****************************************************************************/
-
-
-void rtl8180_irq_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- //priv->irq_enabled = 1;
-/*
- write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
- INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
- INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
- INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
-*/
- write_nic_word(dev,INTA_MASK, priv->irq_mask);
-}
-
-
-void rtl8180_irq_disable(struct net_device *dev)
-{
-// struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- write_nic_word(dev,INTA_MASK,0);
- force_pci_posting(dev);
-// priv->irq_enabled = 0;
-}
-
-
-void rtl8180_set_mode(struct net_device *dev,int mode)
-{
- u8 ecmd;
- ecmd=read_nic_byte(dev, EPROM_CMD);
- ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK;
- ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT);
- ecmd=ecmd &~ (1<<EPROM_CS_SHIFT);
- ecmd=ecmd &~ (1<<EPROM_CK_SHIFT);
- write_nic_byte(dev, EPROM_CMD, ecmd);
-}
-
-
-void rtl8180_update_msr(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- u8 msr;
-
- msr = read_nic_byte(dev, MSR);
- msr &= ~ MSR_LINK_MASK;
-
- /* do not change in link_state != WLAN_LINK_ASSOCIATED.
- * msr must be updated if the state is ASSOCIATING.
- * this is intentional and make sense for ad-hoc and
- * master (see the create BSS/IBSS func)
- */
- if (priv->ieee80211->state == IEEE80211_LINKED){
-
- if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
- msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
- else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
- msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
- else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
- msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-
- }else
- msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-
- write_nic_byte(dev, MSR, msr);
-}
-
-void rtl8180_set_chan(struct net_device *dev,short ch)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u32 tx;
- priv->chan=ch;
- #if 0
- if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
- priv->ieee80211->iw_mode == IW_MODE_MASTER){
-
- priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
- priv->ieee80211->master_chan = ch;
- rtl8180_update_beacon_ch(dev);
- }
- #endif
-
- /* this hack should avoid frame TX during channel setting*/
- tx = read_nic_dword(dev,TX_CONF);
- tx &= ~TX_LOOPBACK_MASK;
-
-#ifndef LOOP_TEST
- write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
-
- priv->rf_set_chan(dev,priv->chan);
- mdelay(10);
- write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT));
-#endif
-}
-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs);
-
-
-void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- int err;
-
-// u8 *rx;
-
- //DMESG("starting RX");
- /*rx = kmalloc(RX_URB_SIZE*sizeof(u8),GFP_ATOMIC);
- if(!rx){
- DMESGE("unable to allocate RX buffer");
- return;
- }*/
-
- usb_fill_bulk_urb(rx_urb,priv->udev,
- usb_rcvbulkpipe(priv->udev,0x81), rx_urb->transfer_buffer,
- RX_URB_SIZE,rtl8187_rx_isr,dev);
- err = usb_submit_urb(rx_urb, GFP_ATOMIC);
- if(err && err != -EPERM){
- DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status);
-
- }
-
-}
-
-
-void rtl8187_rx_initiate(struct net_device *dev)
-{
- int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- if(!priv->rx_urb)
- DMESGE("Cannot intiate RX urb mechanism");
- for(i=0;i<MAX_RX_URB;i++) // RX_MAX_URB is 1
- rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]);
-
-}
-
-void rtl8187_set_rxconf(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u32 rxconf;
-
- rxconf=read_nic_dword(dev,RX_CONF);
- rxconf = rxconf &~ MAC_FILTER_MASK;
- rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
-
- if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
- dev->flags & IFF_PROMISC){
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- }else{
- rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
- }
-
- /*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
- }*/
-
- if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
- rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
- }
-
- if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
- rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-
- rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
- rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-
-
- rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-
- rxconf = rxconf &~ MAX_RX_DMA_MASK;
- rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
- rxconf = rxconf | RCR_ONLYERLPKT;
-
-// rxconf = rxconf &~ RCR_CS_MASK;
-// rxconf = rxconf | (1<<RCR_CS_SHIFT);
-
- write_nic_dword(dev, RX_CONF, rxconf);
-
- // V rtl suggested V //
-// write_nic_dword(dev, RX_CONF, 0x901ce70e);
-
- //fix_rx_fifo(dev);
-// //set_nic_rxring(dev);
- #ifdef DEBUG_RX
- DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF));
- #endif
-}
-
-void rtl8180_rx_enable(struct net_device *dev)
-{
- u8 cmd;
-
-
- rtl8187_rx_initiate(dev);
-
- rtl8187_set_rxconf(dev);
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
-#if 0
- /* In rtl8139 driver seems that DMA threshold has to be written
- * after enabling RX, so we rewrite RX_CONFIG register
- */
- //mdelay(100);
- write_nic_dword(dev, RX_CONF, rxconf);
-
-#endif
-
-}
-
-
-void rtl8180_tx_enable(struct net_device *dev)
-{
- u8 cmd;
- u8 byte;
- u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- byte = read_nic_byte(dev,CW_CONF);
- byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
- byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
- write_nic_byte(dev, CW_CONF, byte);
-
- byte = read_nic_byte(dev, TX_AGC_CTL);
- byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
- byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
- byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT);
- write_nic_byte(dev, TX_AGC_CTL, byte);
-
- txconf= read_nic_dword(dev,TX_CONF);
-
- #if 0
- if(priv->card_8185){
-
- txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
- }else{
-
- if(priv->ieee80211->hw_seq)
- txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- else
- txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
- }
- #endif
-
- txconf = txconf &~ TX_LOOPBACK_MASK;
-
-#ifndef LOOP_TEST
- txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
-#else
- txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
-#endif
- txconf = txconf &~ TCR_DPRETRY_MASK;
- txconf = txconf &~ TCR_RTSRETRY_MASK;
-
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT); // long
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT); // short
-
- txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
- txconf = txconf &~ TCR_MXDMA_MASK;
- txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-
- txconf = txconf | TCR_CWMIN;
- txconf = txconf | TCR_DISCW;
- txconf = txconf &~ TCR_SWPLCPLEN;
-
- txconf=txconf | (1<<TX_NOICV_SHIFT);
-
- write_nic_dword(dev,TX_CONF,txconf);
-
- // V RTL suggested V //
-// write_nic_dword(dev,TX_CONF,0x00e00707);
-
-
-#ifdef DEBUG_TX
- DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
-#endif
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
-
-// mdelay(100);
- //write_nic_dword(dev,TX_CONF,txconf);
-// #endif
-/*
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev, TX_DMA_POLLING, priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- */
-}
-
-#if 0
-void rtl8180_beacon_tx_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-
-
-void rtl8180_
-_disable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-
-#endif
-
-
-void rtl8180_rtx_disable(struct net_device *dev)
-{
- u8 cmd;
- int i;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- cmd=read_nic_byte(dev,CMD);
- write_nic_byte(dev, CMD, cmd &~ \
- ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
- force_pci_posting(dev);
- mdelay(10);
- if(priv->rx_urb){
- for(i=0;i<MAX_RX_URB;i++)
- usb_kill_urb(priv->rx_urb[i]);
- }
- /*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
- udelay(10);
- */
-
-// if(!priv->rx_skb_complete)
-// dev_kfree_skb_any(priv->rx_skb);
-}
-
-
-int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
-{
- #if 0
- int i;
- u32 *tmp;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
- sizeof(u32)*8*count,
- &priv->txbeaconringdma);
- if (!priv->txbeaconring) return -1;
- for (tmp=priv->txbeaconring,i=0;i<count;i++){
- *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
- /*
- *(tmp+2) = (u32)dma_tmp;
- *(tmp+3) = bufsize;
- */
- if(i+1<count)
- *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
- else
- *(tmp+4) = (u32)priv->txbeaconringdma;
-
- tmp=tmp+8;
- }
- #endif
- return 0;
-}
-
-
-void rtl8180_reset(struct net_device *dev)
-{
-
- u8 cr;
-
- /* make sure the analog power is on before
- * reset, otherwise reset may fail
- */
- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
- rtl8180_irq_disable(dev);
-
- mdelay(200);
- write_nic_byte_E(dev,0x18,0x10);
- write_nic_byte_E(dev,0x18,0x11);
- write_nic_byte_E(dev,0x18,0x00);
- mdelay(200);
-
- cr=read_nic_byte(dev,CMD);
- cr = cr & 2;
- cr = cr | (1<<CMD_RST_SHIFT);
- write_nic_byte(dev,CMD,cr);
-
- force_pci_posting(dev);
-
- mdelay(200);
-
- if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
- DMESGW("Card reset timeout!");
- else
- DMESG("Card successfully reset");
-
- rtl8180_set_mode(dev,EPROM_CMD_LOAD);
- force_pci_posting(dev);
- mdelay(200);
-
- /* after the eeprom load cycle, make sure we have
- * correct anaparams
- */
- rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
-}
-
-inline u16 ieeerate2rtlrate(int rate)
-{
- switch(rate){
- case 10:
- return 0;
- case 20:
- return 1;
- case 55:
- return 2;
- case 110:
- return 3;
- case 60:
- return 4;
- case 90:
- return 5;
- case 120:
- return 6;
- case 180:
- return 7;
- case 240:
- return 8;
- case 360:
- return 9;
- case 480:
- return 10;
- case 540:
- return 11;
- default:
- return 3;
-
- }
-}
-static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
-inline u16 rtl8180_rate2rate(short rate)
-{
- if (rate >11) return 0;
- return rtl_rate[rate];
-}
-
-
-void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)rx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- priv->rxurb_task = rx_urb;
-// DMESGW("David: Rx tasklet start!");
- tasklet_schedule(&priv->irq_rx_tasklet);
-// DMESGW("=David: Rx tasklet finish!");
-}
-
-#if 0
-void rtl8180_tx_queues_stop(struct net_device *dev)
-{
- //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
- dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
-
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-#endif
-
-void rtl8180_data_hard_stop(struct net_device *dev)
-{
- //FIXME !!
- #if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- #endif
-}
-
-
-void rtl8180_data_hard_resume(struct net_device *dev)
-{
- // FIXME !!
- #if 0
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
- #endif
-}
-
-
-/* this function TX data frames when the ieee80211 stack requires this.
- * It checks also if we need to stop the ieee tx queue, eventually do it
- */
-void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- short morefrag = 0;
- unsigned long flags;
- struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data;
-
- if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS)
- morefrag = 1;
-// DMESG("%x %x", h->frame_ctl, h->seq_ctl);
- /*
- * This function doesn't require lock because we make
- * sure it's called with the tx_lock already acquired.
- * this come from the kernel's hard_xmit callback (trought
- * the ieee stack, or from the try_wake_queue (again trought
- * the ieee stack.
- */
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- //DMESG("TX");
- if (!check_nic_enought_desc(dev, LOW_PRIORITY)){
- DMESG("Error: no TX slot ");
- ieee80211_stop_queue(priv->ieee80211);
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, LOW_PRIORITY, morefrag,
- ieeerate2rtlrate(rate));
-
- priv->stats.txdatapkt++;
-
- if (!check_nic_enought_desc(dev, LOW_PRIORITY))
- ieee80211_stop_queue(priv->ieee80211);
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
-}
-#if 0
-/* This is a rough attempt to TX a frame
- * This is called by the ieee 80211 stack to TX management frames.
- * If the ring is full packet are dropped (for data frame the queue
- * is stopped before this can happen).
- */
-int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- int ret;
- unsigned long flags;
-
- spin_lock_irqsave(&priv->tx_lock,flags);
-
- ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, 0,DEFAULT_BASICRATE);
-/*
- int i;
- for(i=0;i<skb->len;i++)
- printk("%x ", skb->data[i]);
- printk("--------------------\n");
-*/
- priv->ieee80211->stats.tx_bytes+=skb->len;
- priv->ieee80211->stats.tx_packets++;
-
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
- dev_kfree_skb_any(skb);
- return ret;
-}
-#endif
-
-#if 0
-// longpre 144+48 shortpre 72+24
-u16 rtl8180_len2duration(u32 len, short rate,short* ext)
-{
- u16 duration;
- u16 drift;
- *ext=0;
-
- switch(rate){
- case 0://1mbps
- *ext=0;
- duration = ((len+4)<<4) /0x2;
- drift = ((len+4)<<4) % 0x2;
- if(drift ==0 ) break;
- duration++;
- break;
-
- case 1://2mbps
- *ext=0;
- duration = ((len+4)<<4) /0x4;
- drift = ((len+4)<<4) % 0x4;
- if(drift ==0 ) break;
- duration++;
- break;
-
- case 2: //5.5mbps
- *ext=0;
- duration = ((len+4)<<4) /0xb;
- drift = ((len+4)<<4) % 0xb;
- if(drift ==0 )
- break;
- duration++;
- break;
-
- default:
- case 3://11mbps
- *ext=0;
- duration = ((len+4)<<4) /0x16;
- drift = ((len+4)<<4) % 0x16;
- if(drift ==0 )
- break;
- duration++;
- if(drift > 6)
- break;
- *ext=1;
- break;
- }
-
- return duration;
-}
-#endif
-
-void rtl8180_try_wake_queue(struct net_device *dev, int pri);
-
-void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(tx_urb->status == 0)
- priv->stats.txlpokint++;
- else
- priv->stats.txlperr++;
- kfree(tx_urb->transfer_buffer);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_lp_pending);
- rtl8180_try_wake_queue(dev,LOW_PRIORITY);
-}
-
-
-void rtl8187_beacon_stop(struct net_device *dev)
-{
- u8 msr, msrm, msr2;
- msr = read_nic_byte(dev, MSR);
- msrm = msr & MSR_LINK_MASK;
- msr2 = msr & ~MSR_LINK_MASK;
- if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
- (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
- write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
- write_nic_byte(dev, MSR, msr);
- }
-
-
-}
-
-
-void rtl8187_net_update(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct ieee80211_network *net;
- net = & priv->ieee80211->current_network;
-
-
- write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
- write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
- //for(i=0;i<ETH_ALEN;i++)
- // write_nic_byte(dev,BSSID+i,net->bssid[i]);
-
- rtl8180_update_msr(dev);
-
-// rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_word(dev, AtimWnd, 2);
- write_nic_word(dev, AtimtrItv, 100);
- write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval);
- write_nic_word(dev, BcnIntTime, 100);
-
-
-}
-
-void rtl8187_beacon_tx(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct sk_buff *skb;
- int i = 0;
-
- rtl8187_net_update(dev);
-
- skb = ieee80211_get_beacon(priv->ieee80211);
-
-
- if(!skb){
- DMESG("not enought memory for allocating beacon");
- return;
- }
-
-#if 0
- while(MAX_TX_URB!=atomic_read(&priv->tx_np_pending)){
- msleep_interruptible_rtl(HZ/2);
- if(i++ > 20){
- DMESG("get stuck to wait EP3 become ready");
- return ;
- }
- }
-#endif
- write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7));
-
- i=0;
- //while(!read_nic_byte(dev,BQREQ & (1<<7)))
- while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 )
- {
- msleep_interruptible_rtl(HZ/2);
- if(i++ > 10){
- DMESG("get stuck to wait HW beacon to be ready");
- return ;
- }
- }
-
- rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY,
- 0, priv->ieee80211->basic_rate);
-
-}
-
-void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs)
-{
- struct net_device *dev = (struct net_device*)tx_urb->context;
- struct r8180_priv *priv = ieee80211_priv(dev);
- if(tx_urb->status == 0)
- priv->stats.txnpokint++;
- else
- priv->stats.txnperr++;
- kfree(tx_urb->transfer_buffer);
- usb_free_urb(tx_urb);
- atomic_dec(&priv->tx_np_pending);
- //rtl8180_try_wake_queue(dev,NORM_PRIORITY);
-}
-
-
-/* This function do the real dirty work: it sends a TX command
- * descriptor plus data URB
- */
-
-short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority,
- short morefrag, short rate)
-{
- u32 *tx;
-// u16 duration;
-// short ext;
- int pend ;
- int status;
- struct urb *tx_urb;
- int urb_len;
- struct r8180_priv *priv = ieee80211_priv(dev);
-// int rate = ieeerate2rtlrate(priv->ieee80211->rate);
-
- pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- /* we are locked here so the two atomic_read and inc are executed without interleaves */
- if( pend > MAX_TX_URB){
- if(priority == NORM_PRIORITY)
- priv->stats.txnpdrop++;
- else
- priv->stats.txlpdrop++;
- return -1;
- }
-
-
- //tx = kmalloc((len + 4*3), GFP_ATOMIC);
- urb_len = len + 4*3;
- if((0 == urb_len%64)||(0 == urb_len%512)) {
- urb_len += 1;
- }
- tx = kmalloc(urb_len, GFP_ATOMIC);
- if(!tx) return -ENOMEM;
-printk(KERN_WARNING "urb_len = %d\n", urb_len);
- tx_urb = usb_alloc_urb(0,GFP_ATOMIC);
-
- if(!tx_urb){
-
- kfree(tx);
- return -ENOMEM;
- }
-
- memcpy(tx+3,txbuf,len);
- tx[0] = 0;
- tx[0] |= len & 0xfff;
- tx[0] |= (1<<15);
-
-// if(priv->shortpre)
-// tx[0] |= (1<<16);
-
- //if(len > priv->rts_threshold){
-// tx[0] |= (1<<23); //ENABLE RTS
-// tx[0] |= (1<<18); //ENABLE CTS
- //}
- if(morefrag) tx[0] |= (1<<17);
- tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */
- tx[0] |= (rate << 24);
- tx[1] = 0;
-
-// duration = rtl8180_len2duration(len,
-// rate,&ext);
-// tx[1] |= (duration & 0x7fff) <<16;
-// if(ext) tx[1] |= (1<<31);
-
-
-// tx[2] = 0x303020;
- tx[2] = 3; // CW min
- tx[2] |= (7<<4); //CW max
- tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim
-
-// printk("%x\n%x\n",tx[0],tx[1]);
-
- #ifdef DUMP_TX
- int i;
- printk("<Tx pkt>--rate %x---",rate);
- for (i = 0; i < (len + 3); i++)
- printk("%2x", ((u8*)tx)[i]);
- printk("---------------\n");
- #endif
-
-
- /* FIXME check what EP is for low/norm PRI */
- usb_fill_bulk_urb(tx_urb,priv->udev,
- usb_sndbulkpipe(priv->udev,(priority == LOW_PRIORITY) ? 2:3), tx,
- urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev);
- status = usb_submit_urb(tx_urb, GFP_ATOMIC);
- if (!status){
- atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending);
- return 0;
- }else{
- DMESGE("Error TX URB %d, error %d",
- atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending),
- status);
- return -1;
- }
-}
-
-
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
-
-
-short rtl8187_usb_initendpoints(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i;
-
- priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * MAX_RX_URB, GFP_KERNEL);
-
- for(i=0;i<MAX_RX_URB;i++){
- priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL);
- if(!priv->rx_urb[i])
- goto destroy;
-
- priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
- if(!priv->rx_urb[i]->transfer_buffer)
- goto destroy1;
-
- priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
- }
-
- return 0;
-
-destroy1:
- usb_free_urb(priv->rx_urb[i]);
-
-destroy:
- while (--i >= 0){
- kfree(priv->rx_urb[i]->transfer_buffer);
- usb_free_urb(priv->rx_urb[i]);
- }
-
- kfree(priv->rx_urb);
-
- priv->rx_urb = NULL;
- DMESGE("Endpoint Alloc Failure");
- return -ENOMEM;
-
-}
-
-void rtl8187_usb_deleteendpoints(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i;
-
- if(priv->rx_urb){
- for(i=0;i<MAX_RX_URB;i++){
- usb_kill_urb(priv->rx_urb[i]);
- kfree(priv->rx_urb[i]->transfer_buffer);
- usb_free_urb(priv->rx_urb[i]);
- }
- kfree(priv->rx_urb);
- priv->rx_urb = NULL;
-
- }
-
-}
-
-
-void rtl8187_set_rate(struct net_device *dev)
-{
- int i;
- u16 word;
- int basic_rate,min_rr_rate,max_rr_rate;
-
-// struct r8180_priv *priv = ieee80211_priv(dev);
-
- //if (ieee80211_is_54g(priv->ieee80211->current_network) &&
-// priv->ieee80211->state == IEEE80211_LINKED){
- basic_rate = ieeerate2rtlrate(240);
- min_rr_rate = ieeerate2rtlrate(60);
- max_rr_rate = ieeerate2rtlrate(240);
-
-//
-// }else{
-// basic_rate = ieeerate2rtlrate(20);
-// min_rr_rate = ieeerate2rtlrate(10);
-// max_rr_rate = ieeerate2rtlrate(110);
-// }
-
- write_nic_byte(dev, RESP_RATE,
- max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT);
-
- word = read_nic_word(dev, BRSR);
- word &= ~BRSR_MBR_8185;
-
-
- for(i=0;i<=basic_rate;i++)
- word |= (1<<i);
-
- write_nic_word(dev, BRSR, word);
- //DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE), read_nic_word(dev,BRSR));
-}
-
-
-void rtl8187_link_change(struct net_device *dev)
-{
-// int i;
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- //write_nic_word(dev, BintrItv, net->beacon_interval);
- rtl8187_net_update(dev);
- /*update timing params*/
- rtl8180_set_chan(dev, priv->chan);
-
- rtl8187_set_rxconf(dev);
-}
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv);
-
-short rtl8180_init(struct net_device *dev)
-{
-
- struct r8180_priv *priv = ieee80211_priv(dev);
- int i, j;
- u16 word;
- int ch;
- //u16 version;
- //u8 hw_version;
- //u8 config3;
-
- //FIXME: these constants are placed in a bad pleace.
-
-// priv->txbuffsize = 1024;
-// priv->txringcount = 32;
-// priv->rxbuffersize = 1024;
-// priv->rxringcount = 32;
-// priv->txbeaconcount = 3;
-// priv->rx_skb_complete = 1;
- //priv->txnp_pending.ispending=0;
- /* ^^ the SKB does not containt a partial RXed
- * packet (is empty)
- */
-
- if(!channels){
- DMESG("No channels, aborting");
- return -1;
- }
- ch=channels;
- // set channels 1..14 allowed in given locale
- for (i=1; i<=14; i++) {
- (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
- ch >>= 1;
- }
- //memcpy(priv->stats,0,sizeof(struct Stats));
-
- //priv->irq_enabled=0;
-
-// priv->stats.rxdmafail=0;
- priv->stats.txrdu=0;
-// priv->stats.rxrdu=0;
-// priv->stats.rxnolast=0;
-// priv->stats.rxnodata=0;
- //priv->stats.rxreset=0;
- //priv->stats.rxwrkaround=0;
-// priv->stats.rxnopointer=0;
- priv->stats.txnperr=0;
- priv->stats.txresumed=0;
-// priv->stats.rxerr=0;
-// priv->stats.rxoverflow=0;
-// priv->stats.rxint=0;
- priv->stats.txnpokint=0;
- /*priv->stats.txhpokint=0;
- priv->stats.txhperr=0;*/
- priv->stats.rxurberr=0;
- priv->stats.rxstaterr=0;
- priv->stats.txoverflow=0;
- priv->stats.rxok=0;
-// priv->stats.txbeaconerr=0;
- priv->stats.txlperr=0;
- priv->stats.txlpokint=0;
-
- priv->ieee80211->iw_mode = IW_MODE_INFRA;
-
- priv->retry_rts = DEFAULT_RETRY_RTS;
- priv->retry_data = DEFAULT_RETRY_DATA;
- priv->ieee80211->rate = 110; //11 mbps
- priv->ieee80211->short_slot = 1;
- priv->ieee80211->mode = IEEE_G;
- priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
- spin_lock_init(&priv->tx_lock);
- INIT_WORK(&priv->reset_wq,(void(*)(void*)) rtl8180_restart,dev);
- sema_init(&priv->wx_sem,1);
- tasklet_init(&priv->irq_rx_tasklet,
- (void(*)(unsigned long))rtl8180_irq_rx_tasklet,
- (unsigned long)priv);
-
- //priv->ieee80211->func =
- // kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
- //memset(priv->ieee80211->func, 0,
- // sizeof(struct ieee80211_helper_functions));
- priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
- priv->ieee80211->iw_mode = IW_MODE_INFRA;
- priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN |
- IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
- IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
- /*IEEE_SOFTMAC_BEACONS | */IEEE_SOFTMAC_SINGLE_QUEUE;
-
- priv->ieee80211->active_scan = 1;
- priv->ieee80211->rate = 110; //11 mbps
- priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
- priv->ieee80211->host_encrypt = 1;
- priv->ieee80211->host_decrypt = 1;
- priv->ieee80211->start_send_beacons = rtl8187_beacon_tx;
- priv->ieee80211->stop_send_beacons = rtl8187_beacon_stop;
- //priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit;
- priv->ieee80211->softmac_hard_start_xmit = NULL;
- priv->ieee80211->set_chan = rtl8180_set_chan;
- priv->ieee80211->link_change = rtl8187_link_change;
- priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit;
- priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop;
- priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume;
- //priv->ieee80211->start_send_beacons = NULL;
- //priv->ieee80211->stop_send_beacons = NULL;
-
- priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-
- priv->card_8185 = 2;
- priv->phy_ver = 2;
- priv->card_type = USB;
-
- #if 0
- hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
-
- switch (hw_version){
- case HW_VERID_R8185_ABC:
- DMESG("MAC controller is a RTL8185 b/g");
- priv->card_8185 = 1;
- /* you should not find a card with 8225 PHY ver < C*/
- priv->phy_ver = 2;
- break;
-
- case HW_VERID_R8185_D:
- DMESG("MAC controller is a RTL8185 b/g (V. D)");
- priv->card_8185 = 2;
- /* you should not find a card with 8225 PHY ver < C*/
- priv->phy_ver = 2;
- break;
-
- case HW_VERID_R8180_ABCD:
- DMESG("MAC controller is a RTL8180");
- priv->card_8185 = 0;
- break;
-
- case HW_VERID_R8180_F:
- DMESG("MAC controller is a RTL8180 (v. F)");
- priv->card_8185 = 0;
- break;
-
- default:
- DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
- priv->card_8185 = 0;
- break;
- }
-
-
- /* you should not found any 8185 Ver B Card */
- priv->card_8185_Bversion = 0;
-
- config3 = read_nic_byte(dev, CONFIG3);
- if(config3 & 0x8){
- priv->card_type = CARDBUS;
- DMESG("This is a CARDBUS NIC");
- }
- else if( config3 & 0x4){
- priv->card_type = MINIPCI;
- DMESG("This is a MINI-PCI NIC");
- }else{
- priv->card_type = PCI;
- DMESG("This is a PCI NIC");
- }
- #endif
- priv->enable_gpio0 = 0;
-
-
- /* commented out just because we already do
- this when resetting the card
- andrea 20050924
- */
- #if 0
-
- u8 txcr, txreg50;
- u32 txreg54, txreg60;
-
- /* enable A/D D/A register */
- txcr = read_nic_byte(dev, 0x59);
-// DMESG("<txcr:%x>", txcr);
- //write_nic_word(dev, 0x59, 0x44);
- write_nic_byte(dev, 0x59, 0x44);
- //write_nic_byte(dev, 0x59, 0xea);
- txcr = read_nic_byte(dev, 0x59);
-// DMESG("<<txcr:%x>>", txcr);
-
- txreg50 = read_nic_byte(dev, 0x50);
- // DMESG("<txreg50:%x>", txreg50);
- write_nic_byte(dev, 0x50, 0xc0);
- txreg50 = read_nic_byte(dev, 0x50);
- // DMESG("<<txreg50:%x>>", txreg50);
-
-
- txreg54 = read_nic_dword(dev, 0x54);
- // DMESG("<txreg54:%x>", txreg54);
- txreg54 = 0xa0000a59;
- // DMESG("<<txreg54:%x>>", txreg54);
- write_nic_dword(dev, 0x54, txreg54);
- txreg54 = read_nic_dword(dev, 0x54);
- // DMESG("<<<txreg54:%x>>>", txreg54);
-
- txreg60 = read_nic_dword(dev, 0x60);
- // DMESG("<txreg60:%x>", txreg60);
-
- write_nic_byte(dev, 0x50, 0x0);
- txcr = read_nic_byte(dev, 0x50);
- // DMESG("<<txcr:%x>>", txcr);
-
-#endif
-
- /*the eeprom type is stored in RCR register bit #6 */
- if (RCR_9356SEL & read_nic_dword(dev, RCR)){
- priv->epromtype=EPROM_93c56;
- DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
- }else{
- priv->epromtype=EPROM_93c46;
- DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
- }
-
- dev->get_stats = rtl8180_stats;
-
- dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
- dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
- dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff;
- dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
- dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
- dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-
- DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
- for(i=1,j=0; i<6; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW0 + j);
- priv->chtxpwr[i]=word & 0xf;
- priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4;
- priv->chtxpwr[i+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12;
- }
-
- for(i=1,j=0; i<4; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW1 + j);
- priv->chtxpwr[i+6]=word & 0xf;
- priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4;
- priv->chtxpwr[i+6+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12;
- }
-
- for(i=1,j=0; i<4; i+=2,j++){
-
- word = eprom_read(dev,EPROM_TXPW2 + j);
- priv->chtxpwr[i+6+4]=word & 0xf;
- priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4;
- priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8;
- priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12;
- }
-
-
- priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID);
-
- word = eprom_read(dev,EPROM_TXPW_BASE);
- priv->cck_txpwr_base = word & 0xf;
- priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
- /* check RF frontend chipset */
-
- switch (priv->rf_chip) {
-
- case EPROM_RFCHIPID_RTL8225U:
-
- DMESG("Card reports RF frontend Realtek 8225");
- DMESGW("This driver has EXPERIMENTAL support for this chipset.");
- DMESGW("use it with care and at your own risk and");
- DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
- if(rtl8225_is_V_z2(dev)){
- priv->rf_init = rtl8225z2_rf_init;
- priv->rf_set_chan = rtl8225z2_rf_set_chan;
- priv->rf_set_sens = NULL;
- DMESG("This seems a new V2 radio");
- }else{
- priv->rf_init = rtl8225_rf_init;
- priv->rf_set_chan = rtl8225_rf_set_chan;
- priv->rf_set_sens = rtl8225_rf_set_sens;
- DMESG("This seems a legacy 1st version radio");
- }
- priv->rf_close = rtl8225_rf_close;
-
- priv->max_sens = RTL8225_RF_MAX_SENS;
- priv->sens = RTL8225_RF_DEF_SENS;
- break;
-
- default:
- DMESGW("Unknown RF module %x",priv->rf_chip);
- DMESGW("Exiting...");
- return -1;
-
- }
-
-// DMESG("Energy threshold: %x",priv->cs_treshold);
- DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7);
- //DMESG("CONFIG2: %x ECONFIG2: %x",read_nic_byte(dev,CONFIG2),eprom_read(dev,EPROM_CONFIG2));
-
- if(rtl8187_usb_initendpoints(dev)!=0){
- DMESG("Endopoints initialization failed");
- return -ENOMEM;
- }
-#if 0
- if (0!=alloc_rx_desc_ring(dev, priv->rxbuffersize, priv->rxringcount))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_NORMPRIORITY_RING_ADDR))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_HIGHPRIORITY_RING_ADDR))
- return -ENOMEM;
-
- if (0!=alloc_tx_desc_ring(dev, priv->txbuffsize, priv->txringcount,
- TX_LOWPRIORITY_RING_ADDR))
- return -ENOMEM;
-
-
- if (0!=alloc_tx_beacon_desc_ring(dev, priv->txbeaconcount))
- return -ENOMEM;
-#endif
-
-
-#ifdef DEBUG_EPROM
- dump_eprom(dev);
-#endif
- return 0;
-
-}
-
-void rtl8185_rf_pins_enable(struct net_device *dev)
-{
-/* u16 tmp;
- tmp = read_nic_word(dev, RFPinsEnable);*/
- write_nic_word(dev, RFPinsEnable, 0x1ff7);// | tmp);
-}
-
-
-void rtl8185_set_anaparam2(struct net_device *dev, u32 a)
-{
- u8 conf3;
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- write_nic_dword(dev, ANAPARAM2, a);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
-}
-
-
-void rtl8180_set_anaparam(struct net_device *dev, u32 a)
-{
- u8 conf3;
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- write_nic_dword(dev, ANAPARAM, a);
-
- conf3 = read_nic_byte(dev, CONFIG3);
- write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
-}
-
-
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
-{
- write_nic_byte(dev, TX_ANTENNA, ant);
- force_pci_posting(dev);
- mdelay(1);
-}
-
-
-void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data)
-{
- //u8 phyr;
- u32 phyw;
-// int i;
-
- adr |= 0x80;
-
- phyw= ((data<<8) | adr);
-
-
-
- // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
- write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
- write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
- write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
- write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
-
- //read_nic_dword(dev, PHY_ADR);
-#if 0
- for(i=0;i<10;i++){
- write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
- phyr = read_nic_byte(dev, PHY_READ);
- if(phyr == (data&0xff)) break;
-
- }
-#endif
- /* this is ok to fail when we write AGC table. check for AGC table might be
- * done by masking with 0x7f instead of 0xff
- */
- //if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data, adr);
- mdelay(1);
-}
-
-
-inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data)
-{
- data = data & 0xff;
- rtl8187_write_phy(dev, adr, data);
-}
-
-
-void write_phy_cck (struct net_device *dev, u8 adr, u32 data)
-{
- data = data & 0xff;
- rtl8187_write_phy(dev, adr, data | 0x10000);
-}
-
-
-void rtl8180_adapter_start(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- //u32 anaparam;
- //u8 config3;
-
- //rtl8180_rtx_disable(dev);
- rtl8180_reset(dev);
-
- write_nic_byte(dev,0x85,0);
- write_nic_byte(dev,0x91,0);
-
- /* light blink! */
- write_nic_byte(dev,0x85,4);
- write_nic_byte(dev,0x91,1);
- write_nic_byte(dev,0x90,0);
-
- priv->irq_mask = 0xffff;
-/*
- priv->dma_poll_mask = 0;
- priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT);
-*/
-// rtl8180_beacon_tx_disable(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
- write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
- write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff );
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
- rtl8180_update_msr(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- write_nic_word(dev,0xf4,0xffff);
- write_nic_byte(dev,
- CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80);
-
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-
- write_nic_dword(dev,INT_TIMEOUT,0);
-
-#ifdef DEBUG_REGISTERS
- rtl8180_dump_reg(dev);
-#endif
-
-
- write_nic_byte(dev, WPA_CONFIG, 0);
-
- write_nic_byte(dev, RATE_FALLBACK, 0x81);
- rtl8187_set_rate(dev);
-
- priv->rf_init(dev);
-
- if(priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev,priv->sens);
-
- write_nic_word(dev,0x5e,1);
-
- #if 1
- //mdelay(1);
- write_nic_word(dev,0xfe,0x10);
-// mdelay(1);
- #endif
- write_nic_byte(dev, TALLY_SEL, 0x80);//Set NQ retry count
-
- write_nic_byte(dev, 0xff, 0x60);
-
- write_nic_word(dev,0x5e,0);
-
-
- rtl8180_irq_enable(dev);
- /*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
- DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
- DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
- if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
- if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
- if(check_nic_enought_desc(dev,LOW_PRIORITY)) DMESG("LOW OK");*/
-}
-
-
-
-/* this configures registers for beacon tx and enables it via
- * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might
- * be used to stop beacon transmission
- */
-#if 0
-void rtl8180_start_tx_beacon(struct net_device *dev)
-{
- int i;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- u16 word;
- DMESG("Enabling beacon TX");
- //write_nic_byte(dev, 0x42,0xe6);// TCR
- //rtl8180_init_beacon(dev);
- //set_nic_txring(dev);
-// rtl8180_prepare_beacon(dev);
- rtl8180_irq_disable(dev);
-// rtl8180_beacon_tx_enable(dev);
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- //write_nic_byte(dev,0x9d,0x20); //DMA Poll
- //write_nic_word(dev,0x7a,0);
- //write_nic_word(dev,0x7a,0x8000);
-
-
- word = read_nic_word(dev, BcnItv);
- word &= ~BcnItv_BcnItv; // clear Bcn_Itv
- write_nic_word(dev, BcnItv, word);
-
- write_nic_word(dev, AtimWnd,
- read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-
- word = read_nic_word(dev, BintrItv);
- word &= ~BintrItv_BintrItv;
-
- //word |= priv->ieee80211->beacon_interval *
- // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
- // FIXME:FIXME check if correct ^^ worked with 0x3e8;
-
- write_nic_word(dev, BintrItv, word);
-
- //write_nic_word(dev,0x2e,0xe002);
- //write_nic_dword(dev,0x30,0xb8c7832e);
- for(i=0; i<ETH_ALEN; i++)
- write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-
-// rtl8180_update_msr(dev);
-
-
- //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
- rtl8180_irq_enable(dev);
-
- /* VV !!!!!!!!!! VV*/
- /*
- rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
- write_nic_byte(dev,0x9d,0x00);
- rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-*/
-}
-#endif
-/***************************************************************************
- -------------------------------NET STUFF---------------------------
-***************************************************************************/
-static struct net_device_stats *rtl8180_stats(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- return &priv->ieee80211->stats;
-}
-
-
-int _rtl8180_up(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- priv->up=1;
-
- //DMESG("Bringing up iface");
-
- rtl8180_adapter_start(dev);
-
- rtl8180_rx_enable(dev);
-
- rtl8180_tx_enable(dev);
-
- ieee80211_softmac_start_protocol(priv->ieee80211);
-
- ieee80211_reset_queue(priv->ieee80211);
- if(!netif_queue_stopped(dev))
- netif_start_queue(dev);
- else
- netif_wake_queue(dev);
-
- return 0;
-}
-
-
-int rtl8180_open(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
- down(&priv->wx_sem);
- ret = rtl8180_up(dev);
- up(&priv->wx_sem);
- return ret;
-
-}
-
-
-int rtl8180_up(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 1) return -1;
-
- return _rtl8180_up(dev);
-}
-
-
-int rtl8180_close(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int ret;
-
- down(&priv->wx_sem);
-
- ret = rtl8180_down(dev);
-
- up(&priv->wx_sem);
-
- return ret;
-
-}
-
-int rtl8180_down(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 0) return -1;
-
- priv->up=0;
-
-/* FIXME */
- if (!netif_queue_stopped(dev))
- netif_stop_queue(dev);
-
- rtl8180_rtx_disable(dev);
- rtl8180_irq_disable(dev);
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
- return 0;
-}
-
-
-void rtl8180_commit(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- if (priv->up == 0) return ;
-
- ieee80211_softmac_stop_protocol(priv->ieee80211);
-
- rtl8180_irq_disable(dev);
- rtl8180_rtx_disable(dev);
- _rtl8180_up(dev);
-}
-
-void rtl8180_restart(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- down(&priv->wx_sem);
-
- rtl8180_commit(dev);
-
- up(&priv->wx_sem);
-}
-
-static void r8180_set_multicast(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- short promisc;
-
- //down(&priv->wx_sem);
-
- /* FIXME FIXME */
-
- promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-
- if (promisc != priv->promisc)
- // rtl8180_commit(dev);
-
- priv->promisc = promisc;
-
- //schedule_work(&priv->reset_wq);
- //up(&priv->wx_sem);
-}
-
-
-int r8180_set_mac_adr(struct net_device *dev, void *mac)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- struct sockaddr *addr = mac;
-
- down(&priv->wx_sem);
-
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
- schedule_work(&priv->reset_wq);
-
- up(&priv->wx_sem);
-
- return 0;
-}
-
-
-/* based on ipw2200 driver */
-int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- down(&priv->wx_sem);
-
- struct iwreq *wrq = (struct iwreq *)rq;
-
- int ret=-1;
- switch (cmd) {
- case RTL_IOCTL_WPA_SUPPLICANT:
- ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
- break;
-
- default:
- ret = -EOPNOTSUPP;
- break;
- }
-
- up(&priv->wx_sem);
-
- return ret;
-}
-
-
-void rtl8180_irq_rx_tasklet(struct r8180_priv *priv)
-{
- struct urb *rx_urb = priv->rxurb_task;
- struct net_device *dev = (struct net_device*)rx_urb->context;
- int status,len,flen;
- struct sk_buff *skb;
- u32 *desc;
-
- //DMESG("rtl8187_rx_isr");
-
- struct ieee80211_rx_stats stats = {
- .signal = 0,
- .noise = -98,
- .rate = 0,
- // .mac_time = jiffies,
- .freq = IEEE80211_24GHZ_BAND,
- };
-
- //DMESG("RX %d ",rx_urb->status);
- status = rx_urb->status;
- if(status == 0){
-
- len = rx_urb->actual_length;
- // len = len - 4 - 15 - 1; /* CRC, DESC, SEPARATOR*/
- len -= 4*4;/* 4 dword and 4 byte CRC */
-
- desc = (u32*)(rx_urb->transfer_buffer + len);
-
- flen = desc[0] & 0xfff;
-
- if( flen <= rx_urb->actual_length){
-
- stats.signal = (desc[1] & 0x7f00)>>8;
- stats.noise = desc[1] &0xff;
- stats.rate = desc[0] >> 20 & 0xf;
- stats.mac_time[0] = desc[2];
- stats.mac_time[1] = desc[3];
- skb = dev_alloc_skb(flen-4);
- //skb_reserve(skb,2);
- if(skb){
- memcpy(skb_put(skb,flen-4),
- rx_urb->transfer_buffer,flen -4);
-
- #ifdef DUMP_RX
- int i;
- for(i=0;i<flen-4;i++)
- printk("%2x ",((u8*)(rx_urb->transfer_buffer))[i]);
- printk("------RATE %x:w---------------\n",stats.rate);
-
- #endif
- priv->stats.rxok++;
- // priv->rxskb = skb;
- // priv->tempstats = &stats;
-
- if(!ieee80211_rx(priv->ieee80211,
- skb, &stats))
- dev_kfree_skb_any(skb);
- }
- }else priv->stats.rxurberr++;
- }else{
- priv->stats.rxstaterr++;
- priv->ieee80211->stats.rx_errors++;
-
- }
-
- if(status != -ENOENT)rtl8187_rx_urbsubmit(dev,rx_urb);
- else DMESG("RX process aborted due to explicit shutdown");
-}
-
-/****************************************************************************
- ---------------------------- USB_STUFF---------------------------
-*****************************************************************************/
-
-
-static int __devinit rtl8187_usb_probe(struct usb_interface *intf,
- const struct usb_device_id *id)
-{
-// unsigned long ioaddr = 0;
- struct net_device *dev = NULL;
- struct r8180_priv *priv= NULL;
- struct usb_device *udev = interface_to_usbdev(intf);
-
-//printk("===> rtl8187_usb_probe()\n");
-
- dev = alloc_ieee80211(sizeof(struct r8180_priv));
-
- SET_MODULE_OWNER(dev);
- usb_set_intfdata(intf, dev);
-
- SET_NETDEV_DEV(dev, &intf->dev);
-
- priv = ieee80211_priv(dev);
- priv->ieee80211 = netdev_priv(dev);
-
- priv->udev=udev;
-
- dev->open = rtl8180_open;
- dev->stop = rtl8180_close;
- //dev->hard_start_xmit = rtl8180_8023_hard_start_xmit;
- dev->tx_timeout = tx_timeout;
- dev->wireless_handlers = &r8180_wx_handlers_def;
- dev->do_ioctl = rtl8180_ioctl;
- dev->set_multicast_list = r8180_set_multicast;
- dev->set_mac_address = r8180_set_mac_adr;
- dev->get_wireless_stats = r8180_get_wireless_stats;
- dev->type=ARPHRD_ETHER;
-
- if (dev_alloc_name(dev, ifname) < 0){
- DMESG("Oops: devname already taken! Trying wlan%%d...\n");
- ifname = "wlan%d";
- dev_alloc_name(dev, ifname);
- }
-
-// dev->open=rtl8180_init;
-
- if(rtl8180_init(dev)!=0){
- DMESG("Initialization failed");
- goto fail;
- }
-
- netif_carrier_off(dev);
- netif_stop_queue(dev);
-
- register_netdev(dev);
-
- rtl8180_proc_init_one(dev);
-
-
- DMESG("Driver probe completed\n");
- return 0;
-
-
-fail:
- free_ieee80211(dev);
-
- DMESG("wlan driver load failed\n");
-
- return -ENODEV;
-
-}
-
-
-static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf)
-{
- struct r8180_priv *priv;
- struct net_device *dev = usb_get_intfdata(intf);
- if(dev){
-
- unregister_netdev(dev);
-
- priv=ieee80211_priv(dev);
-
- rtl8180_proc_remove_one(dev);
-
- rtl8180_down(dev);
- priv->rf_close(dev);
- //rtl8180_rtx_disable(dev);
- rtl8187_usb_deleteendpoints(dev);
- rtl8180_irq_disable(dev);
- rtl8180_reset(dev);
- mdelay(10);
-
- }
-// pci_disable_device(pdev);
- free_ieee80211(dev);
- DMESG("wlan driver removed\n");
-}
-
-
-static int __init rtl8187_usb_module_init(void)
-{
- printk(KERN_INFO "\nLinux kernel driver for RTL8187 \
-based WLAN cards\n");
- printk(KERN_INFO "Copyright (c) 2004-2005, Andrea Merello\n");
- DMESG("Initializing module");
- DMESG("Wireless extensions version %d", WIRELESS_EXT);
- rtl8180_proc_module_init();
- return usb_register(&rtl8187_usb_driver);
-}
-
-
-static void __exit rtl8187_usb_module_exit(void)
-{
- usb_deregister(&rtl8187_usb_driver);
-
- rtl8180_proc_module_remove();
- DMESG("Exiting");
-}
-
-
-void rtl8180_try_wake_queue(struct net_device *dev, int pri)
-{
- unsigned long flags;
- short enough_desc;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- spin_lock_irqsave(&priv->tx_lock,flags);
- enough_desc = check_nic_enought_desc(dev,pri);
- spin_unlock_irqrestore(&priv->tx_lock,flags);
-
- if(enough_desc)
- ieee80211_wake_queue(priv->ieee80211);
-}
-
-
-
-/***************************************************************************
- ------------------- module init / exit stubs ----------------
-****************************************************************************/
-module_init(rtl8187_usb_module_init);
-module_exit(rtl8187_usb_module_exit);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h 2006-06-06 08:48:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h 2008-02-22 15:02:01.000000000 +0100
@@ -1,17 +1,17 @@
-/*
+/*
This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
+
+ Parts of this driver are based on the GPL part of the
official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
+
+ Parts of this driver are based on the rtl8180 driver skeleton
from Patric Schenke & Andres Salomon
-
+
Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
+
+ We want to tanks the Authors of those projects and the Ndiswrapper
project Authors.
*/
@@ -26,7 +26,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/sched.h>
@@ -47,6 +46,12 @@
#include <asm/io.h>
#include <asm/semaphore.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#define EPROM_93c46 0
@@ -68,7 +73,7 @@
{
struct buffer *next;
u32 *buf;
-
+
} buffer;
#if 0
@@ -123,18 +128,18 @@
short epromtype;
int irq;
struct ieee80211_device *ieee80211;
-
+
short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
short enable_gpio0;
enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
short hw_plcp_len;
-
+
// spinlock_t irq_lock;
// spinlock_t irq_th_lock;
spinlock_t tx_lock;
-
+
u16 irq_mask;
// short irq_enabled;
struct net_device *dev;
@@ -143,13 +148,18 @@
short max_sens;
u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_orig[15]; //channels from 1 to 14, 0 not used
+ u8 chtxpwr_ofdm_orig[15]; //channels from 1 to 14, 0 not used
u8 cck_txpwr_base;
u8 ofdm_txpwr_base;
+ u8 txpwr_max;
u8 challow[15]; //channels from 1 to 14, 0 not used
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
+ short prism_hdr;
+ short fasttx;
+ short highpower;
+
// struct timer_list scan_timer;
/*short scanpending;
short stopscan;*/
@@ -158,7 +168,7 @@
//u8 active_scan_num;
struct semaphore wx_sem;
// short hw_wep;
-
+
// short digphy;
// short antb;
// short diversity;
@@ -171,31 +181,31 @@
void (*rf_close)(struct net_device *dev);
void (*rf_init)(struct net_device *dev);
//short rate;
- short promisc;
+ short promisc;
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
struct proc_dir_entry *dir_dev;
-
+
/*RX stuff*/
// u32 *rxring;
// u32 *rxringtail;
// dma_addr_t rxringdma;
struct urb **rx_urb;
-
+
//struct buffer *rxbuffer;
//struct buffer *rxbufferhead;
//int rxringcount;
//u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
+
+ //struct sk_buff *rx_skb;
//short rx_skb_complete;
//u32 rx_prevlen;
atomic_t tx_lp_pending;
atomic_t tx_np_pending;
-#if 0
+#if 0
/*TX stuff*/
u32 *txlpring;
u32 *txhpring;
@@ -225,7 +235,7 @@
struct urb *rxurb_task;
// u8 dma_poll_mask;
//short tx_suspend;
-
+
/* adhoc/master mode stuff */
#if 0
u32 *txbeacontail;
@@ -239,22 +249,23 @@
//u16 master_beaconinterval;
// u32 master_beaconsize;
//u16 beacon_interval;
-
+
u8 retry_data;
u8 retry_rts;
-
+
struct work_struct reset_wq;
-
+
}r8180_priv;
-typedef enum{
+typedef enum{
LOW_PRIORITY ,
- NORM_PRIORITY
+ NORM_PRIORITY
} priority_t;
short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
+short rtl8180_tx_fast(struct net_device *dev,u32* skbuf, int len, short rate);
u8 read_nic_byte(struct net_device *dev, int x);
u8 read_nic_byte_E(struct net_device *dev, int x);
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~
--- rtl8187_linux_26.1010.0622.2006/beta-8187/r8187.h~ 2006-06-06 04:58:02.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.h~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,288 +0,0 @@
-/*
- This is part of rtl8187 OpenSource driver.
- Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
- Released under the terms of GPL (General Public Licence)
-
- Parts of this driver are based on the GPL part of the
- official realtek driver
-
- Parts of this driver are based on the rtl8180 driver skeleton
- from Patric Schenke & Andres Salomon
-
- Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
- We want to tanks the Authors of those projects and the Ndiswrapper
- project Authors.
-*/
-
-#ifndef R8180H
-#define R8180H
-
-
-#define RTL8187_MODULE_NAME "rtl8187"
-#define DMESG(x,a...) printk(KERN_INFO RTL8187_MODULE_NAME ": " x "\n", ## a)
-#define DMESGW(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": WW:" x "\n", ## a)
-#define DMESGE(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": EE:" x "\n", ## a)
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/netdevice.h>
-//#include <linux/pci.h>
-#include <linux/usb.h>
-#include <linux/etherdevice.h>
-#include <linux/delay.h>
-#include <linux/rtnetlink.h> //for rtnl_lock()
-#include <linux/wireless.h>
-#include <linux/timer.h>
-#include <linux/proc_fs.h> // Necessary because we use the proc fs
-#include <linux/if_arp.h>
-#include <linux/random.h>
-#include <linux/version.h>
-#include <asm/io.h>
-#include <asm/semaphore.h>
-
-#include "ieee80211.h"
-
-#define EPROM_93c46 0
-#define EPROM_93c56 1
-
-#define DEFAULT_FRAG_THRESHOLD 2342U
-#define MIN_FRAG_THRESHOLD 256U
-#define DEFAULT_BEACONINTERVAL 0x64U
-#define DEFAULT_BEACON_ESSID "Rtl8187"
-
-#define DEFAULT_SSID ""
-#define DEFAULT_RETRY_RTS 7
-#define DEFAULT_RETRY_DATA 7
-#define PRISM_HDR_SIZE 64
-
-#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30
-
-typedef struct buffer
-{
- struct buffer *next;
- u32 *buf;
-
-} buffer;
-
-#if 0
-
-typedef struct tx_pendingbuf
-{
- struct ieee80211_txb *txb;
- short ispending;
- short descfrag;
-} tx_pendigbuf;
-
-#endif
-
-typedef struct Stats
-{
- unsigned long txrdu;
-// unsigned long rxrdu;
- //unsigned long rxnolast;
- //unsigned long rxnodata;
-// unsigned long rxreset;
-// unsigned long rxwrkaround;
-// unsigned long rxnopointer;
- unsigned long rxok;
- unsigned long rxurberr;
- unsigned long rxstaterr;
- unsigned long txnperr;
- unsigned long txnpdrop;
- unsigned long txresumed;
-// unsigned long rxerr;
-// unsigned long rxoverflow;
-// unsigned long rxint;
- unsigned long txnpokint;
-// unsigned long txhpokint;
-// unsigned long txhperr;
-// unsigned long ints;
-// unsigned long shints;
- unsigned long txoverflow;
-// unsigned long rxdmafail;
-// unsigned long txbeacon;
-// unsigned long txbeaconerr;
- unsigned long txlpokint;
- unsigned long txlpdrop;
- unsigned long txlperr;
- unsigned long txdatapkt;
-} Stats;
-
-
-
-typedef struct r8180_priv
-{
- struct usb_device *udev;
- short epromtype;
- int irq;
- struct ieee80211_device *ieee80211;
-
- short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */
- short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
- short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
- short enable_gpio0;
- enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
- short hw_plcp_len;
-
-// spinlock_t irq_lock;
-// spinlock_t irq_th_lock;
- spinlock_t tx_lock;
-
- u16 irq_mask;
-// short irq_enabled;
- struct net_device *dev;
- short chan;
- short sens;
- short max_sens;
- u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
- u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
- u8 cck_txpwr_base;
- u8 ofdm_txpwr_base;
- u8 challow[15]; //channels from 1 to 14, 0 not used
- short up;
- short crcmon; //if 1 allow bad crc frame reception in monitor mode
-// short prism_hdr;
-
-// struct timer_list scan_timer;
- /*short scanpending;
- short stopscan;*/
-// spinlock_t scan_lock;
-// u8 active_probe;
- //u8 active_scan_num;
- struct semaphore wx_sem;
-// short hw_wep;
-
-// short digphy;
-// short antb;
-// short diversity;
-// u8 cs_treshold;
-// short rcr_csense;
- short rf_chip;
-// u32 key0[4];
- short (*rf_set_sens)(struct net_device *dev,short sens);
- void (*rf_set_chan)(struct net_device *dev,short ch);
- void (*rf_close)(struct net_device *dev);
- void (*rf_init)(struct net_device *dev);
- //short rate;
- short promisc;
- /*stats*/
- struct Stats stats;
- struct iw_statistics wstats;
- struct proc_dir_entry *dir_dev;
-
- /*RX stuff*/
-// u32 *rxring;
-// u32 *rxringtail;
-// dma_addr_t rxringdma;
- struct urb **rx_urb;
-
- //struct buffer *rxbuffer;
- //struct buffer *rxbufferhead;
- //int rxringcount;
- //u16 rxbuffersize;
-
- //struct sk_buff *rx_skb;
-
- //short rx_skb_complete;
-
- //u32 rx_prevlen;
- atomic_t tx_lp_pending;
- atomic_t tx_np_pending;
-#if 0
- /*TX stuff*/
- u32 *txlpring;
- u32 *txhpring;
- u32 *txnpring;
- dma_addr_t txlpringdma;
- dma_addr_t txhpringdma;
- dma_addr_t txnpringdma;
- u32 *txlpringtail;
- u32 *txhpringtail;
- u32 *txnpringtail;
- u32 *txlpringhead;
- u32 *txhpringhead;
- u32 *txnpringhead;
- struct buffer *txlpbufs;
- struct buffer *txhpbufs;
- struct buffer *txnpbufs;
- struct buffer *txlpbufstail;
- struct buffer *txhpbufstail;
- struct buffer *txnpbufstail;
- int txringcount;
- int txbuffsize;
-
- //struct tx_pendingbuf txnp_pending;
- struct tasklet_struct irq_tx_tasklet;
-#endif
-// struct tasklet_struct irq_rx_tasklet;
-// u8 dma_poll_mask;
- //short tx_suspend;
-
- /* adhoc/master mode stuff */
-#if 0
- u32 *txbeacontail;
- dma_addr_t txbeaconringdma;
- u32 *txbeaconring;
- int txbeaconcount;
-#endif
-// struct ieee_tx_beacon *beacon_buf;
- //char *master_essid;
-// dma_addr_t beacondmabuf;
- //u16 master_beaconinterval;
-// u32 master_beaconsize;
- //u16 beacon_interval;
-
- u8 retry_data;
- u8 retry_rts;
-
- struct work_struct reset_wq;
-
-}r8180_priv;
-
-
-typedef enum{
- LOW_PRIORITY ,
- NORM_PRIORITY
- } priority_t;
-
-
-short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate);
-
-u8 read_nic_byte(struct net_device *dev, int x);
-u8 read_nic_byte_E(struct net_device *dev, int x);
-u32 read_nic_dword(struct net_device *dev, int x);
-u16 read_nic_word(struct net_device *dev, int x) ;
-void write_nic_byte(struct net_device *dev, int x,u8 y);
-void write_nic_byte_E(struct net_device *dev, int x,u8 y);
-void write_nic_word(struct net_device *dev, int x,u16 y);
-void write_nic_dword(struct net_device *dev, int x,u32 y);
-void force_pci_posting(struct net_device *dev);
-
-void rtl8180_rtx_disable(struct net_device *);
-void rtl8180_rx_enable(struct net_device *);
-void rtl8180_tx_enable(struct net_device *);
-
-void rtl8180_disassociate(struct net_device *dev);
-//void fix_rx_fifo(struct net_device *dev);
-void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a);
-
-void rtl8180_set_anaparam(struct net_device *dev,u32 a);
-void rtl8185_set_anaparam2(struct net_device *dev,u32 a);
-void rtl8180_update_msr(struct net_device *dev);
-int rtl8180_down(struct net_device *dev);
-int rtl8180_up(struct net_device *dev);
-void rtl8180_commit(struct net_device *dev);
-void rtl8180_set_chan(struct net_device *dev,short ch);
-void write_phy(struct net_device *dev, u8 adr, u8 data);
-void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
-void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
-void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
-void rtl8187_set_rxconf(struct net_device *dev);
-#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod
--- rtl8187_linux_26.1010.0622.2006/beta-8187/.tmp_versions/r8187.mod 2006-06-22 07:40:15.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/.tmp_versions/r8187.mod 2008-02-22 15:33:11.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187.ko
-/usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8187_core.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_93cx6.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_wx.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225.o /usr/rtl8187_linux_26.1010.0619.2006/beta-8187/r8180_rtl8225z2.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8187_core.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_93cx6.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_wx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/beta-8187/r8180_rtl8225z2.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.c 2008-01-30 17:38:11.000000000 +0100
@@ -11,7 +11,6 @@
*
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -19,6 +18,12 @@
#include <asm/string.h>
#include <asm/errno.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_AUTHOR("Jouni Malinen");
@@ -38,7 +43,7 @@
static struct ieee80211_crypto *hcrypt;
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *ieee,
int force)
{
struct list_head *ptr, *n;
@@ -61,13 +66,13 @@
}
}
-void ieee80211_crypt_deinit_handler(unsigned long data)
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long data)
{
struct ieee80211_device *ieee = (struct ieee80211_device *)data;
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
- ieee80211_crypt_deinit_entries(ieee, 0);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 0);
if (!list_empty(&ieee->crypt_deinit_list)) {
printk(KERN_DEBUG "%s: entries remaining in delayed crypt "
"deletion list\n", ieee->dev->name);
@@ -78,7 +83,7 @@
}
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt)
{
struct ieee80211_crypt_data *tmp;
@@ -103,7 +108,7 @@
spin_unlock_irqrestore(&ieee->lock, flags);
}
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct ieee80211_crypto_alg *alg;
@@ -128,7 +133,7 @@
return 0;
}
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops)
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops)
{
unsigned long flags;
struct list_head *ptr;
@@ -159,7 +164,7 @@
}
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name)
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name)
{
unsigned long flags;
struct list_head *ptr;
@@ -186,13 +191,13 @@
}
-static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; }
-static void ieee80211_crypt_null_deinit(void *priv) {}
+static void * ieee80211_crypt_null_init_rtl7(int keyidx) { return (void *) 1; }
+static void ieee80211_crypt_null_deinit_rtl7(void *priv) {}
static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.name = "NULL",
- .init = ieee80211_crypt_null_init,
- .deinit = ieee80211_crypt_null_deinit,
+ .init = ieee80211_crypt_null_init_rtl7,
+ .deinit = ieee80211_crypt_null_deinit_rtl7,
.encrypt_mpdu = NULL,
.decrypt_mpdu = NULL,
.encrypt_msdu = NULL,
@@ -205,7 +210,7 @@
};
-static int __init ieee80211_crypto_init(void)
+static int __init ieee80211_crypto_init_rtl7(void)
{
int ret = -ENOMEM;
@@ -217,7 +222,7 @@
INIT_LIST_HEAD(&hcrypt->algs);
spin_lock_init(&hcrypt->lock);
- ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null);
+ ret = ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_null);
if (ret < 0) {
kfree(hcrypt);
hcrypt = NULL;
@@ -227,7 +232,7 @@
}
-static void __exit ieee80211_crypto_deinit(void)
+static void __exit ieee80211_crypto_deinit_rtl7(void)
{
struct list_head *ptr, *n;
@@ -247,13 +252,13 @@
kfree(hcrypt);
}
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler_rtl7);
+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit_rtl7);
+
+EXPORT_SYMBOL(ieee80211_register_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops_rtl7);
+EXPORT_SYMBOL(ieee80211_get_crypto_ops_rtl7);
-module_init(ieee80211_crypto_init);
-module_exit(ieee80211_crypto_deinit);
+module_init(ieee80211_crypto_init_rtl7);
+module_exit(ieee80211_crypto_deinit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_ccmp.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.c 2008-01-30 17:38:11.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -22,11 +21,22 @@
#include <asm/string.h>
#include <linux/wireless.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
@@ -51,7 +61,11 @@
int key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm;
+#else
+ struct crypto_cipher *tfm;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN],
@@ -59,7 +73,8 @@
u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN];
};
-void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
struct scatterlist src, dst;
@@ -74,8 +89,15 @@
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
}
+#else
+static inline void ieee80211_ccmp_aes_encrypt_rtl7(struct crypto_cipher *tfm,
+ const u8 pt[16], u8 ct[16])
+{
+ crypto_cipher_encrypt_one(tfm, ct, pt);
+}
+#endif
-static void * ieee80211_ccmp_init(int key_idx)
+static void * ieee80211_ccmp_init_rtl7(int key_idx)
{
struct ieee80211_ccmp_data *priv;
@@ -85,19 +107,33 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
+#else
+ priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
+ "crypto API aes\n");
+ priv->tfm = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(priv->tfm);
+#else
+ crypto_free_cipher(priv->tfm);
+#endif
kfree(priv);
}
@@ -105,16 +141,20 @@
}
-static void ieee80211_ccmp_deinit(void *priv)
+static void ieee80211_ccmp_deinit_rtl7(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_free_tfm(_priv->tfm);
+#else
+ crypto_free_cipher(_priv->tfm);
+#endif
kfree(priv);
}
-static inline void xor_block(u8 *b, u8 *a, size_t len)
+static inline void xor_block_rtl7(u8 *b, u8 *a, size_t len)
{
int i;
for (i = 0; i < len; i++)
@@ -122,7 +162,11 @@
}
-static void ccmp_init_blocks(struct crypto_tfm *tfm,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static void ccmp_init_blocks_rtl7(struct crypto_tfm *tfm,
+#else
+static void ccmp_init_blocks_rtl7(struct crypto_cipher *tfm,
+#endif
struct ieee80211_hdr *hdr,
u8 *pn, size_t dlen, u8 *b0, u8 *auth,
u8 *s0)
@@ -186,18 +230,18 @@
}
/* Start with the first block and AAD */
- ieee80211_ccmp_aes_encrypt(tfm, b0, auth);
- xor_block(auth, aad, AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
- xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
- ieee80211_ccmp_aes_encrypt(tfm, auth, auth);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, auth);
+ xor_block_rtl7(auth, aad, AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
+ xor_block_rtl7(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, auth, auth);
b0[0] &= 0x07;
b0[14] = b0[15] = 0;
- ieee80211_ccmp_aes_encrypt(tfm, b0, s0);
+ ieee80211_ccmp_aes_encrypt_rtl7(tfm, b0, s0);
}
-static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
int data_len, i, blocks, last, len;
@@ -237,7 +281,7 @@
*pos++ = key->tx_pn[0];
hdr = (struct ieee80211_hdr *) skb->data;
- ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -245,13 +289,13 @@
for (i = 1; i <= blocks; i++) {
len = (i == blocks && last) ? last : AES_BLOCK_LEN;
/* Authentication */
- xor_block(b, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, b, b);
+ xor_block_rtl7(b, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b, b);
/* Encryption, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, e);
- xor_block(pos, e, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, e);
+ xor_block_rtl7(pos, e, len);
pos += len;
}
@@ -262,7 +306,7 @@
}
-static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_ccmp_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_ccmp_data *key = priv;
u8 keyidx, *pos;
@@ -326,8 +370,8 @@
return -4;
}
- ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
- xor_block(mic, b, CCMP_MIC_LEN);
+ ccmp_init_blocks_rtl7(key->tfm, hdr, pn, data_len, b0, a, b);
+ xor_block_rtl7(mic, b, CCMP_MIC_LEN);
blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
last = data_len % AES_BLOCK_LEN;
@@ -337,11 +381,11 @@
/* Decrypt, with counter */
b0[14] = (i >> 8) & 0xff;
b0[15] = i & 0xff;
- ieee80211_ccmp_aes_encrypt(key->tfm, b0, b);
- xor_block(pos, b, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, b0, b);
+ xor_block_rtl7(pos, b, len);
/* Authentication */
- xor_block(a, pos, len);
- ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
+ xor_block_rtl7(a, pos, len);
+ ieee80211_ccmp_aes_encrypt_rtl7(key->tfm, a, a);
pos += len;
}
@@ -365,11 +409,15 @@
}
-static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = data->tfm;
+#else
+ struct crypto_cipher *tfm = data->tfm;
+#endif
keyidx = data->key_idx;
memset(data, 0, sizeof(*data));
@@ -396,7 +444,7 @@
}
-static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_ccmp_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_ccmp_data *data = priv;
@@ -420,7 +468,7 @@
}
-static char * ieee80211_ccmp_print_stats(char *p, void *priv)
+static char * ieee80211_ccmp_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_ccmp_data *ccmp = priv;
p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
@@ -437,34 +485,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp_rtl7 = {
.name = "CCMP",
- .init = ieee80211_ccmp_init,
- .deinit = ieee80211_ccmp_deinit,
- .encrypt_mpdu = ieee80211_ccmp_encrypt,
- .decrypt_mpdu = ieee80211_ccmp_decrypt,
+ .init = ieee80211_ccmp_init_rtl7,
+ .deinit = ieee80211_ccmp_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_ccmp_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_ccmp_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = ieee80211_ccmp_set_key,
- .get_key = ieee80211_ccmp_get_key,
- .print_stats = ieee80211_ccmp_print_stats,
+ .set_key = ieee80211_ccmp_set_key_rtl7,
+ .get_key = ieee80211_ccmp_get_key_rtl7,
+ .print_stats = ieee80211_ccmp_print_stats_rtl7,
.extra_prefix_len = CCMP_HDR_LEN,
.extra_postfix_len = CCMP_MIC_LEN,
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_ccmp_init(void)
+static int __init ieee80211_crypto_ccmp_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-static void __exit ieee80211_crypto_ccmp_exit(void)
+static void __exit ieee80211_crypto_ccmp_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_ccmp_rtl7);
}
-module_init(ieee80211_crypto_ccmp_init);
-module_exit(ieee80211_crypto_ccmp_exit);
+module_init(ieee80211_crypto_ccmp_init_rtl7);
+module_exit(ieee80211_crypto_ccmp_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt.h 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.h 2008-01-30 17:38:11.000000000 +0100
@@ -75,12 +75,12 @@
atomic_t refcnt;
};
-int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
-int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
-struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name);
-void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int);
-void ieee80211_crypt_deinit_handler(unsigned long);
-void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
+int ieee80211_register_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+int ieee80211_unregister_crypto_ops_rtl7(struct ieee80211_crypto_ops *ops);
+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops_rtl7(const char *name);
+void ieee80211_crypt_deinit_entries_rtl7(struct ieee80211_device *, int);
+void ieee80211_crypt_deinit_handler_rtl7(unsigned long);
+void ieee80211_crypt_delayed_deinit_rtl7(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt);
#endif
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_tkip.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.c 2008-01-30 17:39:05.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,13 +20,24 @@
#include <linux/if_arp.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: TKIP");
MODULE_LICENSE("GPL");
@@ -55,14 +65,21 @@
int key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm_arc4;
struct crypto_tfm *tfm_michael;
+#else
+ struct crypto_blkcipher *rx_tfm_arc4;
+ struct crypto_blkcipher *tx_tfm_arc4;
+ struct crypto_hash *rx_tfm_michael;
+ struct crypto_hash *tx_tfm_michael;
+#endif
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16], tx_hdr[16];
};
-static void * ieee80211_tkip_init(int key_idx)
+static void * ieee80211_tkip_init_rtl7(int key_idx)
{
struct ieee80211_tkip_data *priv;
@@ -72,28 +89,74 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0);
if (priv->tfm_arc4 == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API arc4\n");
goto fail;
}
-
priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0);
if (priv->tfm_michael == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
"crypto API michael_mic\n");
goto fail;
}
+#else
+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->tx_tfm_michael = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_arc4)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm_arc4 = NULL;
+ goto fail;
+ }
+
+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm_michael)) {
+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
+ "crypto API michael_mic\n");
+ priv->rx_tfm_michael = NULL;
+ goto fail;
+ }
+#endif
return priv;
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm_michael)
crypto_free_tfm(priv->tfm_michael);
if (priv->tfm_arc4)
crypto_free_tfm(priv->tfm_arc4);
+#else
+ if (priv->tx_tfm_michael)
+ crypto_free_hash(priv->tx_tfm_michael);
+ if (priv->tx_tfm_arc4)
+ crypto_free_blkcipher(priv->tx_tfm_arc4);
+ if (priv->rx_tfm_michael)
+ crypto_free_hash(priv->rx_tfm_michael);
+ if (priv->rx_tfm_arc4)
+ crypto_free_blkcipher(priv->rx_tfm_arc4);
+#endif
kfree(priv);
}
@@ -101,13 +164,26 @@
}
-static void ieee80211_tkip_deinit(void *priv)
+static void ieee80211_tkip_deinit_rtl7(void *priv)
{
struct ieee80211_tkip_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm_michael)
crypto_free_tfm(_priv->tfm_michael);
if (_priv && _priv->tfm_arc4)
crypto_free_tfm(_priv->tfm_arc4);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm_michael)
+ crypto_free_hash(_priv->tx_tfm_michael);
+ if (_priv->tx_tfm_arc4)
+ crypto_free_blkcipher(_priv->tx_tfm_arc4);
+ if (_priv->rx_tfm_michael)
+ crypto_free_hash(_priv->rx_tfm_michael);
+ if (_priv->rx_tfm_arc4)
+ crypto_free_blkcipher(_priv->rx_tfm_arc4);
+ }
+#endif
kfree(priv);
}
@@ -200,7 +276,7 @@
#define PHASE1_LOOP_COUNT 8
-static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
+static void tkip_mixing_phase1_rtl7(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32)
{
int i, j;
@@ -222,7 +298,7 @@
}
-static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
+static void tkip_mixing_phase2_rtl7(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
u16 IV16)
{
/* Make temporary area overlap WEP seed so that the final copy can be
@@ -268,7 +344,7 @@
#endif
}
-static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_encrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int len;
@@ -276,6 +352,9 @@
struct ieee80211_hdr *hdr;
u32 crc;
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 };
+#endif
if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -283,11 +362,11 @@
hdr = (struct ieee80211_hdr *) skb->data;
if (!tkey->tx_phase1_done) {
- tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
+ tkip_mixing_phase1_rtl7(tkey->tx_ttak, tkey->key, hdr->addr2,
tkey->tx_iv32);
tkey->tx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
len = skb->len - hdr_len;
pos = skb_push(skb, 8);
@@ -310,11 +389,23 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 2, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4);
+#else
+ crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
tkey->tx_iv16++;
if (tkey->tx_iv16 == 0) {
@@ -325,7 +416,7 @@
return 0;
}
-static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_tkip_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 rc4key[16];
@@ -337,6 +428,9 @@
u32 crc;
struct scatterlist sg;
int plen;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 };
+#endif
if (skb->len < hdr_len + 8 + 4)
return -1;
@@ -382,18 +476,30 @@
}
if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
- tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
+ tkip_mixing_phase1_rtl7(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
tkey->rx_phase1_done = 1;
}
- tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
+ tkip_mixing_phase2_rtl7(rc4key, tkey->key, tkey->rx_ttak, iv16);
plen = skb->len - hdr_len - 12;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16);
+#else
+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4);
+#else
+ crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4);
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -427,33 +533,59 @@
return keyidx;
}
-
-static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static int michael_mic_rtl7(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr,
u8 *data, size_t data_len, u8 *mic)
{
struct scatterlist sg[2];
if (tkey->tfm_michael == NULL) {
+#else
+static int michael_mic_rtl7(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr,
+ u8 *data, size_t data_len, u8 *mic)
+{
+ struct hash_desc desc;
+ struct scatterlist sg[2];
+
+ if (tfm_michael == NULL) {
+#endif
printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
return -1;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[0].page = virt_to_page(hdr);
sg[0].offset = offset_in_page(hdr);
sg[0].length = 16;
+#else
+ sg_set_page(&sg[0], virt_to_page(hdr), 16, offset_in_page(hdr));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg[1].page = virt_to_page(data);
sg[1].offset = offset_in_page(data);
sg[1].length = data_len;
+#else
+ sg_set_page(&sg[1], virt_to_page(data), data_len, offset_in_page(data));
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
crypto_digest_init(tkey->tfm_michael);
crypto_digest_setkey(tkey->tfm_michael, key, 8);
crypto_digest_update(tkey->tfm_michael, sg, 2);
crypto_digest_final(tkey->tfm_michael, mic);
return 0;
+#else
+ if (crypto_hash_setkey(tfm_michael, key, 8))
+ return -1;
+
+ desc.tfm = tfm_michael;
+ desc.flags = 0;
+ return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+#endif
}
-static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
+static void michael_mic_hdr_rtl7(struct sk_buff *skb, u8 *hdr)
{
struct ieee80211_hdr *hdr11;
@@ -483,7 +615,7 @@
}
-static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv)
+static int ieee80211_michael_mic_add_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
u8 *pos;
@@ -495,18 +627,24 @@
return -1;
}
- michael_mic_hdr(skb, tkey->tx_hdr);
+ michael_mic_hdr_rtl7(skb, tkey->tx_hdr);
pos = skb_put(skb, 8);
- if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[16], tkey->tx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, pos))
return -1;
+#endif
return 0;
}
#if WIRELESS_EXT >= 18
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -527,7 +665,7 @@
wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev);
}
#elif WIRELESS_EXT >= 15
-static void ieee80211_michael_mic_failure(struct net_device *dev,
+static void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -543,7 +681,7 @@
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
}
#else /* WIRELESS_EXT >= 15 */
-static inline void ieee80211_michael_mic_failure(struct net_device *dev,
+static inline void ieee80211_michael_mic_failure_rtl7(struct net_device *dev,
struct ieee80211_hdr *hdr,
int keyidx)
{
@@ -551,7 +689,7 @@
#endif /* WIRELESS_EXT >= 15 */
-static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
+static int ieee80211_michael_mic_verify_rtl7(struct sk_buff *skb, int keyidx,
int hdr_len, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -560,10 +698,16 @@
if (!tkey->key_set)
return -1;
- michael_mic_hdr(skb, tkey->rx_hdr);
- if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr,
+ michael_mic_hdr_rtl7(skb, tkey->rx_hdr);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+ if (michael_mic_rtl7(tkey, &tkey->key[24], tkey->rx_hdr,
+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
+ return -1;
+#else
+ if (michael_mic_rtl7(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
return -1;
+#endif
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
struct ieee80211_hdr *hdr;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -572,7 +716,7 @@
skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2),
keyidx);
if (skb->dev)
- ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
+ ieee80211_michael_mic_failure_rtl7(skb->dev, hdr, keyidx);
tkey->dot11RSNAStatsTKIPLocalMICFailures++;
return -1;
}
@@ -588,18 +732,33 @@
}
-static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
int keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
struct crypto_tfm *tfm = tkey->tfm_michael;
struct crypto_tfm *tfm2 = tkey->tfm_arc4;
+#else
+ struct crypto_hash *tfm = tkey->tx_tfm_michael;
+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4;
+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael;
+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4;
+#endif
keyidx = tkey->key_idx;
memset(tkey, 0, sizeof(*tkey));
tkey->key_idx = keyidx;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
tkey->tfm_michael = tfm;
tkey->tfm_arc4 = tfm2;
+#else
+ tkey->tx_tfm_michael = tfm;
+ tkey->tx_tfm_arc4 = tfm2;
+ tkey->rx_tfm_michael = tfm3;
+ tkey->rx_tfm_arc4 = tfm4;
+#endif
+
if (len == TKIP_KEY_LEN) {
memcpy(tkey->key, key, TKIP_KEY_LEN);
tkey->key_set = 1;
@@ -618,7 +777,7 @@
}
-static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv)
+static int ieee80211_tkip_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct ieee80211_tkip_data *tkey = priv;
@@ -648,7 +807,7 @@
}
-static char * ieee80211_tkip_print_stats(char *p, void *priv)
+static char * ieee80211_tkip_print_stats_rtl7(char *p, void *priv)
{
struct ieee80211_tkip_data *tkip = priv;
p += sprintf(p, "key[%d] alg=TKIP key_set=%d "
@@ -675,34 +834,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
+static struct ieee80211_crypto_ops ieee80211_crypt_tkip_rtl7 = {
.name = "TKIP",
- .init = ieee80211_tkip_init,
- .deinit = ieee80211_tkip_deinit,
- .encrypt_mpdu = ieee80211_tkip_encrypt,
- .decrypt_mpdu = ieee80211_tkip_decrypt,
- .encrypt_msdu = ieee80211_michael_mic_add,
- .decrypt_msdu = ieee80211_michael_mic_verify,
- .set_key = ieee80211_tkip_set_key,
- .get_key = ieee80211_tkip_get_key,
- .print_stats = ieee80211_tkip_print_stats,
+ .init = ieee80211_tkip_init_rtl7,
+ .deinit = ieee80211_tkip_deinit_rtl7,
+ .encrypt_mpdu = ieee80211_tkip_encrypt_rtl7,
+ .decrypt_mpdu = ieee80211_tkip_decrypt_rtl7,
+ .encrypt_msdu = ieee80211_michael_mic_add_rtl7,
+ .decrypt_msdu = ieee80211_michael_mic_verify_rtl7,
+ .set_key = ieee80211_tkip_set_key_rtl7,
+ .get_key = ieee80211_tkip_get_key_rtl7,
+ .print_stats = ieee80211_tkip_print_stats_rtl7,
.extra_prefix_len = 4 + 4, /* IV + ExtIV */
.extra_postfix_len = 8 + 4, /* MIC + ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_tkip_init(void)
+static int __init ieee80211_crypto_tkip_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-static void __exit ieee80211_crypto_tkip_exit(void)
+static void __exit ieee80211_crypto_tkip_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_tkip_rtl7);
}
-module_init(ieee80211_crypto_tkip_init);
-module_exit(ieee80211_crypto_tkip_exit);
+module_init(ieee80211_crypto_tkip_init_rtl7);
+module_exit(ieee80211_crypto_tkip_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_crypt_wep.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.c 2008-01-30 17:39:05.000000000 +0100
@@ -9,7 +9,6 @@
* more details.
*/
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -18,13 +17,24 @@
#include <linux/skbuff.h>
#include <asm/string.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
#include <linux/crypto.h>
-#include <asm/scatterlist.h>
#include <linux/crc32.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ #include <asm/scatterlist.h>
+#else
+ #include <linux/scatterlist.h>
+#endif
+
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
@@ -36,11 +46,16 @@
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
struct crypto_tfm *tfm;
+#else
+ struct crypto_blkcipher *rx_tfm;
+ struct crypto_blkcipher *tx_tfm;
+#endif
};
-static void * prism2_wep_init(int keyidx)
+static void * prism2_wep_init_rtl7(int keyidx)
{
struct prism2_wep_data *priv;
@@ -50,13 +65,30 @@
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
+#else
+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->tx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->tx_tfm = NULL;
+ goto fail;
+ }
+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(priv->rx_tfm)) {
+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+ "crypto API arc4\n");
+ priv->rx_tfm = NULL;
+ goto fail;
+ }
+#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
@@ -64,19 +96,35 @@
fail:
if (priv) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (priv->tfm)
crypto_free_tfm(priv->tfm);
+#else
+ if (priv->tx_tfm)
+ crypto_free_blkcipher(priv->tx_tfm);
+ if (priv->rx_tfm)
+ crypto_free_blkcipher(priv->rx_tfm);
+#endif
kfree(priv);
}
return NULL;
}
-static void prism2_wep_deinit(void *priv)
+static void prism2_wep_deinit_rtl7(void *priv)
{
struct prism2_wep_data *_priv = priv;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
+#else
+ if (_priv) {
+ if (_priv->tx_tfm)
+ crypto_free_blkcipher(_priv->tx_tfm);
+ if (_priv->rx_tfm)
+ crypto_free_blkcipher(_priv->rx_tfm);
+ }
+#endif
kfree(priv);
}
@@ -87,13 +135,16 @@
*
* 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)
+static int prism2_wep_encrypt_rtl7(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 (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
+#endif
if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 ||
skb->len < hdr_len)
@@ -134,13 +185,25 @@
icv[2] = crc >> 16;
icv[3] = crc >> 24;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
- crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
+#else
+ sg_set_page(&sg, virt_to_page(pos), len + 4, offset_in_page(pos));
+#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
+#else
+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
+#endif
}
@@ -151,13 +214,16 @@
* Returns 0 if frame was decrypted successfully and ICV was correct and -1 on
* failure. If frame is OK, IV and ICV will be removed.
*/
-static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
+static int prism2_wep_decrypt_rtl7(struct sk_buff *skb, int hdr_len, void *priv)
{
struct prism2_wep_data *wep = priv;
u32 crc, klen, plen;
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos, icv[4];
struct scatterlist sg;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
+ struct blkcipher_desc desc = { .tfm = wep->rx_tfm };
+#endif
if (skb->len < hdr_len + 8)
return -1;
@@ -178,11 +244,26 @@
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_setkey(wep->tfm, key, klen);
+#else
+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
+#else
+ sg_set_page(&sg, virt_to_page(pos), plen + 4, offset_in_page(pos));
+#endif
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
+#else
+ if(crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
+ return -7;
+#endif
crc = ~crc32_le(~0, pos, plen);
icv[0] = crc;
@@ -203,7 +284,7 @@
}
-static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_set_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -217,7 +298,7 @@
}
-static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv)
+static int prism2_wep_get_key_rtl7(void *key, int len, u8 *seq, void *priv)
{
struct prism2_wep_data *wep = priv;
@@ -230,7 +311,7 @@
}
-static char * prism2_wep_print_stats(char *p, void *priv)
+static char * prism2_wep_print_stats_rtl7(char *p, void *priv)
{
struct prism2_wep_data *wep = priv;
p += sprintf(p, "key[%d] alg=WEP len=%d\n",
@@ -239,34 +320,34 @@
}
-static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
+static struct ieee80211_crypto_ops ieee80211_crypt_wep_rtl7 = {
.name = "WEP",
- .init = prism2_wep_init,
- .deinit = prism2_wep_deinit,
- .encrypt_mpdu = prism2_wep_encrypt,
- .decrypt_mpdu = prism2_wep_decrypt,
+ .init = prism2_wep_init_rtl7,
+ .deinit = prism2_wep_deinit_rtl7,
+ .encrypt_mpdu = prism2_wep_encrypt_rtl7,
+ .decrypt_mpdu = prism2_wep_decrypt_rtl7,
.encrypt_msdu = NULL,
.decrypt_msdu = NULL,
- .set_key = prism2_wep_set_key,
- .get_key = prism2_wep_get_key,
- .print_stats = prism2_wep_print_stats,
+ .set_key = prism2_wep_set_key_rtl7,
+ .get_key = prism2_wep_get_key_rtl7,
+ .print_stats = prism2_wep_print_stats_rtl7,
.extra_prefix_len = 4, /* IV */
.extra_postfix_len = 4, /* ICV */
.owner = THIS_MODULE,
};
-static int __init ieee80211_crypto_wep_init(void)
+static int __init ieee80211_crypto_wep_init_rtl7(void)
{
- return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
+ return ieee80211_register_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-static void __exit ieee80211_crypto_wep_exit(void)
+static void __exit ieee80211_crypto_wep_exit_rtl7(void)
{
- ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
+ ieee80211_unregister_crypto_ops_rtl7(&ieee80211_crypt_wep_rtl7);
}
-module_init(ieee80211_crypto_wep_init);
-module_exit(ieee80211_crypto_wep_exit);
+module_init(ieee80211_crypto_wep_init_rtl7);
+module_exit(ieee80211_crypto_wep_exit_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211.h 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211.h 2008-01-30 17:38:11.000000000 +0100
@@ -120,7 +120,7 @@
static inline unsigned long msleep_interruptible_rtl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
-
+
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
@@ -156,6 +156,22 @@
struct list_head list;
};
+#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */
+/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header
+ * (from linux-wlan-ng) */
+struct linux_wlan_ng_val {
+ u32 did;
+ u16 status, len;
+ u32 data;
+} __attribute__ ((packed));
+
+struct linux_wlan_ng_prism_hdr {
+ u32 msgcode, msglen;
+ char devname[16];
+ struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal,
+ noise, rate, istx, frmlen;
+} __attribute__ ((packed));
+
struct ieee80211_hdr {
u16 frame_ctl;
u16 duration_id;
@@ -798,7 +814,7 @@
/* the card is not linked at all */
IEEE80211_NOLINK = 0,
-
+
/* IEEE80211_ASSOCIATING* are for BSS client mode
* the driver shall not perform RX filtering unless
* the state is LINKED.
@@ -806,31 +822,31 @@
* defaults to NOLINK for ALL the other states (including
* LINKED_SCANNING)
*/
-
+
/* the association procedure will start (wq scheduling)*/
IEEE80211_ASSOCIATING,
IEEE80211_ASSOCIATING_RETRY,
-
+
/* the association procedure is sending AUTH request*/
IEEE80211_ASSOCIATING_AUTHENTICATING,
-
+
/* the association procedure has successfully authentcated
* and is sending association request
*/
IEEE80211_ASSOCIATING_AUTHENTICATED,
-
+
/* the link is ok. the card associated to a BSS or linked
* to a ibss cell or acting as an AP and creating the bss
*/
IEEE80211_LINKED,
-
+
/* same as LINKED, but the driver shall apply RX filter
* rules as we are in NO_LINK mode. As the card is still
* logically linked, but it is doing a syncro site survey
* then it will be back to LINKED state.
*/
IEEE80211_LINKED_SCANNING,
-
+
};
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
@@ -840,14 +856,14 @@
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
-extern inline int is_multicast_ether_addr(const u8 *addr)
+extern inline int is_multicast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
-extern inline int is_broadcast_ether_addr(const u8 *addr)
+extern inline int is_broadcast_ether_addr_rtl7(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
@@ -870,7 +886,7 @@
struct net_device_stats stats;
struct ieee80211_stats ieee_stats;
struct ieee80211_softmac_stats softmac_stats;
-
+
/* Probe / Beacon management */
struct list_head network_free_list;
struct list_head network_list;
@@ -881,7 +897,7 @@
int iw_mode; /* operating mode (IW_MODE_*) */
spinlock_t lock;
-
+
int tx_headroom; /* Set to size of any additional room needed at front
* of allocated Tx SKBs */
u32 config;
@@ -924,11 +940,11 @@
* ad-hoc is a mixture ;-).
* Note that in infrastructure mode, even when not associated,
* fields bssid and essid may be valid (if wpa_set and essid_set
- * are true) as thy carry the value set by the user via iwconfig
+ * are true) as thy carry the value set by the user via iwconfig
*/
struct ieee80211_network current_network;
-
+
enum ieee80211_state state;
int short_slot;
@@ -936,33 +952,33 @@
int modulation; /* CCK, OFDM */
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
int abg_true; /* ABG flag */
-
- /* used for forcing the ibss workqueue to terminate
+
+ /* used for forcing the ibss workqueue to terminate
* without wait for the syncro scan to terminate
*/
- short sync_scan_hurryup;
-
+ short sync_scan_hurryup;
+
/* map of allowed channels. 0 is dummy */
// FIXME: remeber to default to a basic channel plan depending of the PHY type
int channel_map[MAX_CHANNEL_NUMBER+1];
-
+
int rate; /* current rate */
int basic_rate;
//FIXME: pleace callback, see if redundant with softmac_features
short active_scan;
-
+
/* this contains flags for selectively enable softmac support */
u16 softmac_features;
-
+
/* if the sequence control field is not filled by HW */
u16 seq_ctrl;
-
+
/* association procedure transaction sequence number */
u16 associate_seq;
-
+
/* AID for RTXed association responses */
u16 assoc_id;
-
+
/* power save mode related*/
short ps;
short sta_sleep;
@@ -970,147 +986,153 @@
struct tasklet_struct ps_task;
u32 ps_th;
u32 ps_tl;
-
+
short raw_tx;
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
short queue_stop;
short scanning;
short proto_started;
-
+
struct semaphore wx_sem;
struct semaphore scan_sem;
-
- spinlock_t mgmt_tx_lock;
+
+ spinlock_t mgmt_tx_lock;
spinlock_t beacon_lock;
short beacon_txing;
short wap_set;
short ssid_set;
-
+
/* for discarding duplicated packets in IBSS */
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-
+
/* for discarding duplicated packets in BSS */
u16 last_seq_num;
u16 last_frag_num;
unsigned long last_packet_time;
-
+
/* for PS mode */
unsigned long last_rx_ps_time;
-
+
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
int mgmt_queue_head;
int mgmt_queue_tail;
-
-
+
+
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
struct tx_pending_t tx_pending;
-
+
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
struct timer_list associate_timer;
/* used if IEEE_SOFTMAC_BEACONS is set */
struct timer_list beacon_timer;
-
+
struct work_struct associate_complete_wq;
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+ struct delayed_work associate_retry_wq;
+ struct delayed_work softmac_scan_wq;
+#else
struct work_struct associate_retry_wq;
+ struct work_struct softmac_scan_wq;
+#endif
struct work_struct start_ibss_wq;
struct work_struct associate_procedure_wq;
- struct work_struct softmac_scan_wq;
struct work_struct wx_sync_scan_wq;
-
+
struct workqueue_struct *wq;
/* Callback functions */
void (*set_security)(struct net_device *dev,
struct ieee80211_security *sec);
-
+
/* Used to TX data frame by using txb structs.
* this is not used if in the softmac_features
* is set the flag IEEE_SOFTMAC_TX_QUEUE
*/
int (*hard_start_xmit)(struct ieee80211_txb *txb,
struct net_device *dev);
-
+
int (*reset_port)(struct net_device *dev);
- /* Softmac-generated frames (mamagement) are TXed via this
- * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
- * not set. As some cards may have different HW queues that
+ /* Softmac-generated frames (mamagement) are TXed via this
+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+ * not set. As some cards may have different HW queues that
* one might want to use for data and management frames
* the option to have two callbacks might be useful.
* This fucntion can't sleep.
*/
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev);
-
+
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
* then also management frames are sent via this callback.
* This function can't sleep.
- */
+ */
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
struct net_device *dev,int rate);
/* stops the HW queue for DATA frames. Useful to avoid
* waste time to TX data frame when we are reassociating
* This function can sleep.
- */
+ */
void (*data_hard_stop)(struct net_device *dev);
-
+
/* OK this is complementar to data_poll_hard_stop */
void (*data_hard_resume)(struct net_device *dev);
-
+
/* ask to the driver to retune the radio .
* This function can sleep. the driver should ensure
* the radio has been swithced before return.
*/
void (*set_chan)(struct net_device *dev,short ch);
-
+
/* These are not used if the ieee stack takes care of
- * scanning (IEEE_SOFTMAC_SCAN feature set).
+ * scanning (IEEE_SOFTMAC_SCAN feature set).
* In this case only the set_chan is used.
*
* The syncro version is similar to the start_scan but
* does not return until all channels has been scanned.
- * this is called in user context and should sleep,
+ * this is called in user context and should sleep,
* it is called in a work_queue when swithcing to ad-hoc mode
- * or in behalf of iwlist scan when the card is associated
- * and root user ask for a scan.
+ * or in behalf of iwlist scan when the card is associated
+ * and root user ask for a scan.
* the fucntion stop_scan should stop both the syncro and
* background scanning and can sleep.
- * The fucntion start_scan should initiate the background
+ * The fucntion start_scan should initiate the background
* scanning and can't sleep.
- */
+ */
void (*scan_syncro)(struct net_device *dev);
void (*start_scan)(struct net_device *dev);
void (*stop_scan)(struct net_device *dev);
-
+
/* indicate the driver that the link state is changed
* for example it may indicate the card is associated now.
- * Driver might be interested in this to apply RX filter
- * rules or simply light the LINK led
+ * Driver might be interested in this to apply RX filter
+ * rules or simply light the LINK led
*/
void (*link_change)(struct net_device *dev);
-
+
/* these two function indicates to the HW when to start
- * and stop to send beacons. This is used when the
+ * and stop to send beacons. This is used when the
* IEEE_SOFTMAC_BEACONS is not set. For now the
* stop_send_bacons is NOT guaranteed to be called only
* after start_send_beacons.
*/
void (*start_send_beacons) (struct net_device *dev);
void (*stop_send_beacons) (struct net_device *dev);
-
+
/* power save mode related */
void (*sta_wake_up) (struct net_device *dev);
void (*ps_request_tx_ack) (struct net_device *dev);
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
short (*ps_is_queue_empty) (struct net_device *dev);
-
-
+
+
/* This must be the last item so that it points to the data
* allocated beyond this structure by alloc_ieee80211 */
u8 priv[0];
@@ -1148,18 +1170,18 @@
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
/* Generate beacons. The stack will enqueue beacons
- * to the card
- */
+ * to the card
+ */
#define IEEE_SOFTMAC_BEACONS (1<<6)
-extern inline void *ieee80211_priv(struct net_device *dev)
+extern inline void *ieee80211_priv_rtl7(struct net_device *dev)
{
return ((struct ieee80211_device *)netdev_priv(dev))->priv;
}
-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
+extern inline int ieee80211_is_empty_essid_rtl7(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
@@ -1175,7 +1197,7 @@
return 1;
}
-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
+extern inline int ieee80211_is_valid_mode_rtl7(struct ieee80211_device *ieee, int mode)
{
/*
* It is possible for both access points and our device to support
@@ -1201,7 +1223,7 @@
return 0;
}
-extern inline int ieee80211_get_hdrlen(u16 fc)
+extern inline int ieee80211_get_hdrlen_rtl7(u16 fc)
{
int hdrlen = 24;
@@ -1229,140 +1251,144 @@
/* ieee80211.c */
-extern void free_ieee80211(struct net_device *dev);
-extern struct net_device *alloc_ieee80211(int sizeof_priv);
+extern void free_ieee80211_rtl7(struct net_device *dev);
+extern struct net_device *alloc_ieee80211_rtl7(int sizeof_priv);
-extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
+extern int ieee80211_set_encryption_rtl7(struct ieee80211_device *ieee);
/* ieee80211_tx.c */
-extern int ieee80211_encrypt_fragment(
+extern int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len);
-
-extern int ieee80211_xmit(struct sk_buff *skb,
+
+extern int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev);
-extern void ieee80211_txb_free(struct ieee80211_txb *);
+extern void ieee80211_txb_free_rtl7(struct ieee80211_txb *);
/* ieee80211_rx.c */
-extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats);
-extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+extern void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats);
/* ieee80211_wx.c */
-extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
-extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
/* ieee80211_softmac.c */
-extern short ieee80211_is_54g(struct ieee80211_network net);
-extern short ieee80211_is_shortslot(struct ieee80211_network net);
-extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+extern short ieee80211_is_54g_rtl7(struct ieee80211_network net);
+extern short ieee80211_is_shortslot_rtl7(struct ieee80211_network net);
+extern int ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype);
-extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net);
+extern void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net);
-extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
-extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_master_bss(struct ieee80211_device *ieee);
-extern void ieee80211_start_ibss(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_init(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_free(struct ieee80211_device *ieee);
-extern void ieee80211_associate_abort(struct ieee80211_device *ieee);
-extern void ieee80211_disassociate(struct ieee80211_device *ieee);
-extern void ieee80211_stop_scan(struct ieee80211_device *ieee);
-extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee);
-extern void ieee80211_check_all_nets(struct ieee80211_device *ieee);
-extern void ieee80211_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
-extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
-extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
-extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
-extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
-extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
-extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
-extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p);
-extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
-extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
+extern void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee);
+extern void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_check_all_nets_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee);
+extern struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee);
+extern int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p);
+extern void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee);
+extern void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success);
/* ieee80211_softmac_wx.c */
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
-
-extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra);
-
-extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
+
+extern int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+
+extern int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+
+extern int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+extern int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
-extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work);
+#else
+extern void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee);
+#endif
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+extern int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+extern int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+extern int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
-
-extern const long ieee80211_wlan_frequencies[];
-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
+extern const long ieee80211_wlan_frequencies_rtl7[];
+
+extern inline void ieee80211_increment_scans_rtl7(struct ieee80211_device *ieee)
{
ieee->scans++;
}
-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
+extern inline int ieee80211_get_scans_rtl7(struct ieee80211_device *ieee)
{
return ieee->scans;
}
@@ -1372,7 +1398,7 @@
const char *s = essid;
char *d = escaped;
- if (ieee80211_is_empty_essid(essid, essid_len)) {
+ if (ieee80211_is_empty_essid_rtl7(essid, essid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
@@ -1390,4 +1416,5 @@
*d = '\0';
return escaped;
}
+
#endif /* IEEE80211_H */
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_module.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.c 2008-01-30 17:38:11.000000000 +0100
@@ -31,7 +31,6 @@
*******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <asm/uaccess.h>
#include <net/arp.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
MODULE_DESCRIPTION("802.11 data/management/control stack");
@@ -60,7 +65,7 @@
#define DRV_NAME "ieee80211"
-static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
+static inline int ieee80211_networks_allocate_rtl7(struct ieee80211_device *ieee)
{
if (ieee->networks)
return 0;
@@ -80,7 +85,7 @@
return 0;
}
-static inline void ieee80211_networks_free(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_free_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->networks)
return;
@@ -88,7 +93,7 @@
ieee->networks = NULL;
}
-static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
+static inline void ieee80211_networks_initialize_rtl7(struct ieee80211_device *ieee)
{
int i;
@@ -99,7 +104,7 @@
}
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211_rtl7(int sizeof_priv)
{
struct ieee80211_device *ieee;
struct net_device *dev;
@@ -113,17 +118,17 @@
goto failed;
}
ieee = netdev_priv(dev);
- dev->hard_start_xmit = ieee80211_xmit;
+ dev->hard_start_xmit = ieee80211_xmit_rtl7;
ieee->dev = dev;
- err = ieee80211_networks_allocate(ieee);
+ err = ieee80211_networks_allocate_rtl7(ieee);
if (err) {
IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
err);
goto failed;
}
- ieee80211_networks_initialize(ieee);
+ ieee80211_networks_initialize_rtl7(ieee);
/* Default fragmentation threshold is maximum payload size */
ieee->fts = DEFAULT_FTS;
@@ -138,7 +143,7 @@
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
init_timer(&ieee->crypt_deinit_timer);
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
- ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler_rtl7;
spin_lock_init(&ieee->lock);
@@ -149,7 +154,7 @@
ieee->ieee802_1x = 1;
ieee->raw_tx = 0;
- ieee80211_softmac_init(ieee);
+ ieee80211_softmac_init_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
@@ -167,7 +172,7 @@
}
-void free_ieee80211(struct net_device *dev)
+void free_ieee80211_rtl7(struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -175,9 +180,9 @@
struct list_head *p, *q;
- ieee80211_softmac_free(ieee);
+ ieee80211_softmac_free_rtl7(ieee);
del_timer_sync(&ieee->crypt_deinit_timer);
- ieee80211_crypt_deinit_entries(ieee, 1);
+ ieee80211_crypt_deinit_entries_rtl7(ieee, 1);
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
@@ -191,7 +196,7 @@
}
}
- ieee80211_networks_free(ieee);
+ ieee80211_networks_free_rtl7(ieee);
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
@@ -210,13 +215,13 @@
u32 ieee80211_debug_level = 0;
struct proc_dir_entry *ieee80211_proc = NULL;
-static int show_debug_level(char *page, char **start, off_t offset,
+static int show_debug_level_rtl7(char *page, char **start, off_t offset,
int count, int *eof, void *data)
{
return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
}
-static int store_debug_level(struct file *file, const char *buffer,
+static int store_debug_level_rtl7(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
@@ -243,7 +248,7 @@
return strnlen(buf, count);
}
-static int __init ieee80211_init(void)
+static int __init ieee80211_init_rtl7(void)
{
struct proc_dir_entry *e;
@@ -268,7 +273,7 @@
return 0;
}
-static void __exit ieee80211_exit(void)
+static void __exit ieee80211_exit_rtl7(void)
{
if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc);
@@ -282,9 +287,9 @@
MODULE_PARM_DESC(debug, "debug output mask");
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
+module_exit(ieee80211_exit_rtl7);
+module_init(ieee80211_init_rtl7);
#endif
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(alloc_ieee80211_rtl7);
+EXPORT_SYMBOL(free_ieee80211_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_rx.c 2006-06-06 04:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.c 2008-01-30 17:38:11.000000000 +0100
@@ -13,16 +13,15 @@
* more details.
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
-
+
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -43,18 +42,89 @@
#include <asm/uaccess.h>
#include <linux/ctype.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
+
#include "ieee80211.h"
-static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
+static inline void ieee80211_monitor_rx_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- u16 fc = le16_to_cpu(hdr->frame_ctl);
+ struct ieee80211_hdr *hdr1 = (struct ieee80211_hdr *)skb->data;
+ u16 fc = le16_to_cpu(hdr1->frame_ctl);
+ int prism_header;
+ int hdrlen, phdrlen, head_need, tail_need;
+
+ if (ieee->dev->type == ARPHRD_IEEE80211_PRISM) {
+ prism_header = 1;
+ phdrlen = sizeof(struct linux_wlan_ng_prism_hdr);
+ } else {
+ prism_header = 0;
+ phdrlen = 0;
+ }
+
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
+
+ /* check if there is enough room for extra data; if not, expand skb
+ * buffer to be large enough for the changes */
+ head_need = phdrlen;
+ tail_need = 0;
+#ifdef PRISM2_ADD_BOGUS_CRC
+ tail_need += 4;
+#endif /* PRISM2_ADD_BOGUS_CRC */
+
+ head_need -= skb_headroom(skb);
+ tail_need -= skb_tailroom(skb);
+
+ if (head_need > 0 || tail_need > 0) {
+ if (pskb_expand_head(skb, head_need > 0 ? head_need : 0,
+ tail_need > 0 ? tail_need : 0,
+ GFP_ATOMIC)) {
+ printk(KERN_DEBUG "%s: ieee80211_rx failed to "
+ "reallocate skb buffer\n", ieee->dev->name);
+ dev_kfree_skb_any(skb);
+ return;
+ }
+ }
+
+ if (prism_header == 1) {
+ struct linux_wlan_ng_prism_hdr *hdr;
+ hdr = (struct linux_wlan_ng_prism_hdr *)
+ skb_push(skb, phdrlen);
+ memset(hdr, 0, phdrlen);
+ hdr->msgcode = LWNG_CAP_DID_BASE;
+ hdr->msglen = sizeof(*hdr);
+ memcpy(hdr->devname, ieee->dev->name, sizeof(hdr->devname));
+#define LWNG_SETVAL(f,i,s,l,d) \
+hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \
+hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
+ LWNG_SETVAL(hosttime, 1, 0, 4, jiffies);
+ LWNG_SETVAL(mactime, 2, 0, 4, ((u32)rx_stats->mac_time));
+ LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0);
+ LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal);
+ LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise);
+ LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5);
+ LWNG_SETVAL(istx, 9, 0, 4, 0);
+ LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen);
+#undef LWNG_SETVAL
+ }
skb->dev = ieee->dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb->mac.raw = skb->data;
- skb_pull(skb, ieee80211_get_hdrlen(fc));
+#else
+ skb_reset_mac_header(skb);
+#endif
+ skb_pull(skb, hdrlen);
+ if (prism_header)
+ skb_pull(skb, phdrlen);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
@@ -64,7 +134,7 @@
/* Called only as a tasklet (software IRQ) */
static struct ieee80211_frag_entry *
-ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq,
+ieee80211_frag_cache_find_rtl7(struct ieee80211_device *ieee, unsigned int seq,
unsigned int frag, u8 *src, u8 *dst)
{
struct ieee80211_frag_entry *entry;
@@ -94,7 +164,7 @@
/* Called only as a tasklet (software IRQ) */
static struct sk_buff *
-ieee80211_frag_cache_get(struct ieee80211_device *ieee,
+ieee80211_frag_cache_get_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
struct sk_buff *skb = NULL;
@@ -133,7 +203,7 @@
} else {
/* received a fragment of a frame for which the head fragment
* should have already been received */
- entry = ieee80211_frag_cache_find(ieee, seq, frag, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, frag, hdr->addr2,
hdr->addr1);
if (entry != NULL) {
entry->last_frag = frag;
@@ -146,7 +216,7 @@
/* Called only as a tasklet (software IRQ) */
-static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
+static int ieee80211_frag_cache_invalidate_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *hdr)
{
u16 sc;
@@ -156,7 +226,7 @@
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
- entry = ieee80211_frag_cache_find(ieee, seq, -1, hdr->addr2,
+ entry = ieee80211_frag_cache_find_rtl7(ieee, seq, -1, hdr->addr2,
hdr->addr1);
if (entry == NULL) {
@@ -178,7 +248,7 @@
*
* Called by ieee80211_rx */
static inline int
-ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
@@ -187,13 +257,13 @@
* response parser uses it
*/
rx_stats->len = skb->len;
- ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
- ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
+ ieee80211_rx_mgt_rtl7(ieee,(struct ieee80211_hdr *)skb->data,rx_stats);
+ ieee80211_rx_frame_softmac_rtl7(ieee, skb, rx_stats, type, stype);
dev_kfree_skb_any(skb);
-
+
return 0;
-
+
#ifdef NOT_YET
if (ieee->iw_mode == IW_MODE_MASTER) {
printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
@@ -253,7 +323,7 @@
/* No encapsulation header if EtherType < 0x600 (=length) */
/* Called by ieee80211_rx_frame_decrypt */
-static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee,
+static int ieee80211_is_eapol_frame_rtl7(struct ieee80211_device *ieee,
struct sk_buff *skb)
{
struct net_device *dev = ieee->dev;
@@ -294,7 +364,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -304,7 +374,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
#ifdef CONFIG_IEEE80211_CRYPT_TKIP
if (ieee->tkip_countermeasures &&
@@ -339,7 +409,7 @@
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
-ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb,
+ieee80211_rx_frame_decrypt_msdu_rtl7(struct ieee80211_device* ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct ieee80211_hdr *hdr;
@@ -349,7 +419,7 @@
return 0;
hdr = (struct ieee80211_hdr *) skb->data;
- hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
+ hdrlen = ieee80211_get_hdrlen_rtl7(le16_to_cpu(hdr->frame_ctl));
atomic_inc(&crypt->refcnt);
res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
@@ -367,7 +437,7 @@
/* this function is stolen from ipw2200 driver*/
#define IEEE_PACKET_RETRY_TIME (5*HZ)
-static int is_duplicate_packet(struct ieee80211_device *ieee,
+static int is_duplicate_packet_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header)
{
// u16 fc = le16_to_cpu(header->frame_ctl);
@@ -413,7 +483,7 @@
last_seq = &ieee->last_seq_num;
last_frag = &ieee->last_frag_num;
last_time = &ieee->last_packet_time;
-
+
break;
default:
return 0;
@@ -436,7 +506,7 @@
drop:
// BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
// printk("DUP\n");
-
+
return 1;
}
@@ -444,7 +514,7 @@
/* All received frames are sent to this function. @skb contains the frame in
* IEEE 802.11 format, i.e., in the format it was sent over air.
* This function is called only as a tasklet (software IRQ). */
-int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
+int ieee80211_rx_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats)
{
struct net_device *dev = ieee->dev;
@@ -481,9 +551,9 @@
type = WLAN_FC_GET_TYPE(fc);
stype = WLAN_FC_GET_STYPE(fc);
sc = le16_to_cpu(hdr->seq_ctl);
-
+
frag = WLAN_GET_SEQ_FRAG(sc);
- hdrlen = ieee80211_get_hdrlen(fc);
+ hdrlen = ieee80211_get_hdrlen_rtl7(fc);
#ifdef NOT_YET
#if WIRELESS_EXT > 15
@@ -501,12 +571,12 @@
}
#endif /* IW_WIRELESS_SPY */
#endif /* WIRELESS_EXT > 15 */
- hostap_update_rx_stats(local->ap, hdr, rx_stats);
+ hostap_update_rx_stats_rtl7(local->ap, hdr, rx_stats);
#endif
#if WIRELESS_EXT > 15
if (ieee->iw_mode == IW_MODE_MONITOR) {
- ieee80211_monitor_rx(ieee, skb, rx_stats);
+ ieee80211_monitor_rx_rtl7(ieee, skb, rx_stats);
stats->rx_packets++;
stats->rx_bytes += skb->len;
return 1;
@@ -529,7 +599,7 @@
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
- (void) hostap_handle_sta_crypto(local, hdr, &crypt,
+ (void) hostap_handle_sta_crypto_rtl7(local, hdr, &crypt,
&sta);
#endif
@@ -555,7 +625,7 @@
if (skb->len < IEEE80211_DATA_HDR3_LEN)
goto rx_dropped;
- if (is_duplicate_packet(ieee, hdr))
+ if (is_duplicate_packet_rtl7(ieee, hdr))
goto rx_dropped;
@@ -573,9 +643,9 @@
goto rx_dropped;
}
#endif
-
-
- if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
+
+
+ if (ieee80211_rx_frame_mgmt_rtl7(ieee, skb, rx_stats, type, stype))
goto rx_dropped;
else
goto rx_exit;
@@ -583,7 +653,7 @@
/* Data frame - extract src/dst addresses */
-
+
switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) {
case IEEE80211_FCTL_FROMDS:
memcpy(dst, hdr->addr1, ETH_ALEN);
@@ -606,7 +676,7 @@
}
#ifdef NOT_YET
- if (hostap_rx_frame_wds(ieee, hdr, fc, &wds))
+ if (hostap_rx_frame_wds_rtl7(ieee, hdr, fc, &wds))
goto rx_dropped;
if (wds) {
skb->dev = dev = wds;
@@ -619,7 +689,7 @@
memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) {
/* Frame from BSSID of the AP for which we are a client */
skb->dev = dev = ieee->stadev;
- stats = hostap_get_stats(dev);
+ stats = hostap_get_stats_rtl7(dev);
from_assoc_ap = 1;
}
#endif
@@ -630,7 +700,7 @@
if ((ieee->iw_mode == IW_MODE_MASTER ||
ieee->iw_mode == IW_MODE_REPEAT) &&
!from_assoc_ap) {
- switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats,
+ switch (hostap_handle_sta_rx_rtl7(ieee, dev, skb, rx_stats,
wds != NULL)) {
case AP_RX_CONTINUE_NOT_AUTHORIZED:
frame_authorized = 0;
@@ -664,7 +734,7 @@
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0)
+ (keyidx = ieee80211_rx_frame_decrypt_rtl7(ieee, skb, crypt)) < 0)
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
@@ -674,7 +744,7 @@
// ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) {
int flen;
- struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr);
+ struct sk_buff *frag_skb = ieee80211_frag_cache_get_rtl7(ieee, hdr);
IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag);
if (!frag_skb) {
@@ -694,7 +764,7 @@
printk(KERN_WARNING "%s: host decrypted and "
"reassembled frame did not fit skb\n",
dev->name);
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
goto rx_dropped;
}
@@ -722,19 +792,19 @@
* delivered, so remove skb from fragment cache */
skb = frag_skb;
hdr = (struct ieee80211_hdr *) skb->data;
- ieee80211_frag_cache_invalidate(ieee, hdr);
+ ieee80211_frag_cache_invalidate_rtl7(ieee, hdr);
}
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
- ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt))
+ ieee80211_rx_frame_decrypt_msdu_rtl7(ieee, skb, keyidx, crypt))
goto rx_dropped;
hdr = (struct ieee80211_hdr *) skb->data;
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
if (/*ieee->ieee802_1x &&*/
- ieee80211_is_eapol_frame(ieee, skb)) {
+ ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
#ifdef CONFIG_IEEE80211_DEBUG
/* pass unencrypted EAPOL frames even if encryption is
* configured */
@@ -763,7 +833,7 @@
#endif
if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep &&
- !ieee80211_is_eapol_frame(ieee, skb)) {
+ !ieee80211_is_eapol_frame_rtl7(ieee, skb)) {
IEEE80211_DEBUG_DROP(
"dropped unencrypted RX data "
"frame from " MAC_FMT
@@ -861,7 +931,12 @@
if (skb2 != NULL) {
/* send to wireless media */
skb2->protocol = __constant_htons(ETH_P_802_3);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
skb2->mac.raw = skb2->nh.raw = skb2->data;
+#else
+ skb_reset_mac_header(skb2);
+ skb_reset_network_header(skb2);
+#endif
/* skb2->nh.raw = skb2->data + ETH_HLEN; */
skb2->dev = dev;
dev_queue_xmit(skb2);
@@ -896,7 +971,7 @@
#define MGMT_FRAME_FIXED_PART_LENGTH 0x24
-static inline int ieee80211_is_ofdm_rate(u8 rate)
+static inline int ieee80211_is_ofdm_rate_rtl7(u8 rate)
{
switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
case IEEE80211_OFDM_RATE_6MB:
@@ -913,7 +988,7 @@
}
-static inline int ieee80211_network_init(
+static inline int ieee80211_network_init_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_network *network,
@@ -964,7 +1039,7 @@
switch (info_element->id) {
case MFIE_TYPE_SSID:
- if (ieee80211_is_empty_essid(info_element->data,
+ if (ieee80211_is_empty_essid_rtl7(info_element->data,
info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID;
break;
@@ -991,7 +1066,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1014,7 +1089,7 @@
#ifdef CONFIG_IEEE80211_DEBUG
p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]);
#endif
- if (ieee80211_is_ofdm_rate(info_element->data[i])) {
+ if (ieee80211_is_ofdm_rate_rtl7(info_element->data[i])) {
network->flags |= NETWORK_HAS_OFDM;
if (info_element->data[i] &
IEEE80211_BASIC_RATE_MASK)
@@ -1043,47 +1118,47 @@
break;
case MFIE_TYPE_TIM:
-
- if(info_element->len < 4)
+
+ if(info_element->len < 4)
break;
-
+
network->dtim_period = info_element->data[1];
-
+
if(ieee->state != IEEE80211_LINKED)
break;
-
- network->last_dtim_sta_time[0] = stats->mac_time[0];
+
+ network->last_dtim_sta_time[0] = stats->mac_time[0];
network->last_dtim_sta_time[1] = stats->mac_time[1];
-
+
network->dtim_data = IEEE80211_DTIM_VALID;
-
- if(info_element->data[0] != 0)
+
+ if(info_element->data[0] != 0)
break;
-
+
if(info_element->data[2] & 1)
network->dtim_data |= IEEE80211_DTIM_MBCAST;
-
+
offset = (info_element->data[2] >> 1)*2;
-
- //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
-
- if(ieee->assoc_id < offset ||
+
+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
+
+ if(ieee->assoc_id < offset ||
ieee->assoc_id > 8*(offset + info_element->len -3))
-
+
break;
-
-
+
+
offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ;
-
- // printk("offset:%x data:%x, ucast:%d\n", offset,
+
+ // printk("offset:%x data:%x, ucast:%d\n", offset,
// info_element->data[3+offset] ,
// info_element->data[3+offset] & (1<<(ieee->assoc_id%8)));
-
+
if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
network->dtim_data |= IEEE80211_DTIM_UCAST;
-
+
break;
-
+
case MFIE_TYPE_IBSS_SET:
IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n");
break;
@@ -1115,7 +1190,7 @@
memcpy(network->rsn_ie, info_element,
network->rsn_ie_len);
break;
-
+
default:
IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
info_element->id);
@@ -1147,7 +1222,7 @@
return 1;
}
- if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
+ if (ieee80211_is_empty_essid_rtl7(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1155,24 +1230,24 @@
return 0;
}
-static inline int is_same_network(struct ieee80211_network *src,
+static inline int is_same_network_rtl7(struct ieee80211_network *src,
struct ieee80211_network *dst)
{
/* A network is only a duplicate if the channel, BSSID, ESSID
- * and the capability field (in particular IBSS and BSS) all match.
+ * and the capability field (in particular IBSS and BSS) all match.
* We treat all <hidden> with the same BSSID and channel
* as one network */
return ((src->ssid_len == dst->ssid_len) &&
(src->channel == dst->channel) &&
!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
- ((src->capability & WLAN_CAPABILITY_IBSS) ==
+ ((src->capability & WLAN_CAPABILITY_IBSS) ==
(dst->capability & WLAN_CAPABILITY_IBSS)) &&
- ((src->capability & WLAN_CAPABILITY_BSS) ==
+ ((src->capability & WLAN_CAPABILITY_BSS) ==
(dst->capability & WLAN_CAPABILITY_BSS)));
}
-static inline void update_network(struct ieee80211_network *dst,
+static inline void update_network_rtl7(struct ieee80211_network *dst,
struct ieee80211_network *src)
{
memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats));
@@ -1194,7 +1269,7 @@
dst->dtim_data = src->dtim_data;
dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
-
+
memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len);
dst->wpa_ie_len = src->wpa_ie_len;
memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
@@ -1204,7 +1279,7 @@
/* dst->last_associate is not overwritten */
}
-static inline void ieee80211_process_probe_response(
+static inline void ieee80211_process_probe_response_rtl7(
struct ieee80211_device *ieee,
struct ieee80211_probe_response *beacon,
struct ieee80211_rx_stats *stats)
@@ -1239,7 +1314,7 @@
(beacon->capability & (1<<0x1)) ? '1' : '0',
(beacon->capability & (1<<0x0)) ? '1' : '0');
- if (ieee80211_network_init(ieee, beacon, &network, stats)) {
+ if (ieee80211_network_init_rtl7(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
escape_essid(info_element->data,
info_element->len),
@@ -1261,12 +1336,12 @@
* already there. */
spin_lock_irqsave(&ieee->lock, flags);
-
- if(is_same_network(&ieee->current_network, &network))
- update_network(&ieee->current_network, &network);
-
+
+ if(is_same_network_rtl7(&ieee->current_network, &network))
+ update_network_rtl7(&ieee->current_network, &network);
+
list_for_each_entry(target, &ieee->network_list, list) {
- if (is_same_network(target, &network))
+ if (is_same_network_rtl7(target, &network))
break;
if ((oldest == NULL) ||
@@ -1306,7 +1381,7 @@
memcpy(target, &network, sizeof(*target));
list_add_tail(&target->list, &ieee->network_list);
if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
} else {
IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
escape_essid(target->ssid,
@@ -1315,39 +1390,39 @@
WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
IEEE80211_STYPE_PROBE_RESP ?
"PROBE RESPONSE" : "BEACON");
-
+
/* we have an entry and we are going to update it. But this entry may
- * be already expired. In this case we do the same as we found a new
+ * be already expired. In this case we do the same as we found a new
* net and call the new_net handler
*/
renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
- update_network(target, &network);
+ update_network_rtl7(target, &network);
if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
- ieee80211_softmac_new_net(ieee,&network);
+ ieee80211_softmac_new_net_rtl7(ieee,&network);
}
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_rx_mgt(struct ieee80211_device *ieee,
+void ieee80211_rx_mgt_rtl7(struct ieee80211_device *ieee,
struct ieee80211_hdr *header,
struct ieee80211_rx_stats *stats)
{
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_BEACON:
IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Beacon\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
-
+
case IEEE80211_STYPE_PROBE_RESP:
IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
IEEE80211_DEBUG_SCAN("Probe response\n");
- ieee80211_process_probe_response(
+ ieee80211_process_probe_response_rtl7(
ieee, (struct ieee80211_probe_response *)header, stats);
break;
@@ -1355,5 +1430,5 @@
}
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
+EXPORT_SYMBOL(ieee80211_rx_mgt_rtl7);
+EXPORT_SYMBOL(ieee80211_rx_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac.c 2006-06-19 03:27:33.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.c 2008-01-30 17:38:11.000000000 +0100
@@ -1,14 +1,14 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Few lines might be stolen from other part of the ieee80211
* stack. Copyright who own it's copyright
*
* WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright.
+ * Copyright who own it's copyright.
*
* released under the GPL
*/
@@ -20,12 +20,12 @@
#include <linux/delay.h>
#include <linux/version.h>
-short ieee80211_is_54g(struct ieee80211_network net)
+short ieee80211_is_54g_rtl7(struct ieee80211_network net)
{
return ((net.rates_ex_len > 0) || (net.rates_len > 4));
}
-short ieee80211_is_shortslot(struct ieee80211_network net)
+short ieee80211_is_shortslot_rtl7(struct ieee80211_network net)
{
return (net.capability & WLAN_CAPABILITY_SHORT_SLOT);
}
@@ -34,28 +34,28 @@
* tag and the EXTENDED RATE MFIE tag if needed.
* It encludes two bytes per tag for the tag itself and its len
*/
-unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
+unsigned int ieee80211_MFIE_rate_len_rtl7(struct ieee80211_device *ieee)
{
unsigned int rate_len = 0;
-
+
if (ieee->modulation & IEEE80211_CCK_MODULATION)
rate_len = IEEE80211_CCK_RATE_LEN + 2;
-
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-
+
rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-
+
return rate_len;
}
-/* pleace the MFIE rate, tag to the memory (double) poined.
+/* pleace the MFIE rate, tag to the memory (double) poined.
* Then it updates the pointer so that
* it points after the new MFIE tag added.
- */
-void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
+ */
+void ieee80211_MFIE_Brate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
{
- u8 *tag = *tag_p;
-
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_CCK_MODULATION){
*tag++ = MFIE_TYPE_RATES;
*tag++ = 4;
@@ -64,17 +64,17 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{
- u8 *tag = *tag_p;
-
+void ieee80211_MFIE_Grate_rtl7(struct ieee80211_device *ieee, u8 **tag_p)
+{
+ u8 *tag = *tag_p;
+
if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-
+
*tag++ = MFIE_TYPE_RATES_EX;
*tag++ = 8;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -85,73 +85,73 @@
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
+
}
-
+
/* We may add an option for custom rates that specific HW might support */
*tag_p = tag;
}
-void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
+void enqueue_mgmt_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
int nh;
nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-
+
/*
* if the queue is full but we have newer frames then
* just overwrites the oldest.
- *
+ *
* if (nh == ieee->mgmt_queue_tail)
* return -1;
- */
+ */
ieee->mgmt_queue_head = nh;
ieee->mgmt_queue_ring[nh] = skb;
-
+
//return 0;
}
-struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
+struct sk_buff *dequeue_mgmt_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *ret;
-
+
if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
return NULL;
-
+
ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-
- ieee->mgmt_queue_tail =
+
+ ieee->mgmt_queue_tail =
(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-
+
return ret;
}
-void init_mgmt_queue(struct ieee80211_device *ieee)
+void init_mgmt_queue_rtl7(struct ieee80211_device *ieee)
{
ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0;
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl);
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl);
-inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
unsigned long flags;
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header=
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
/* called with 2nd param 0, no mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
-
+ ieee80211_sta_wakeup_rtl7(ieee,0);
+
if(single){
-
+
if(ieee->queue_stop){
-
- enqueue_mgmt(ieee,skb);
-
+
+ enqueue_mgmt_rtl7(ieee,skb);
+
}else{
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
@@ -159,119 +159,119 @@
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}else{
spin_unlock_irqrestore(&ieee->lock, flags);
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags);
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags);
}
}
-inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
+inline void softmac_ps_mgmt_xmit_rtl7(struct sk_buff *skb, struct ieee80211_device *ieee)
{
-
+
short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
-
+
+
if(single){
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
/* avoid watchdog triggers */
ieee->dev->trans_start = jiffies;
ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-
+
}else{
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
ieee->softmac_hard_start_xmit(skb,ieee->dev);
-
+
}
}
-inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_probe_req_rtl7(struct ieee80211_device *ieee)
{
unsigned int len,rate_len;
u8 *tag;
struct sk_buff *skb;
struct ieee80211_probe_request *req;
-
+
len = ieee->current_network.ssid_len;
-
- rate_len = ieee80211_MFIE_rate_len(ieee);
-
+
+ rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
2 + len + rate_len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
- req->header.duration_id = 0; //FIXME: is this OK ?
-
+ req->header.duration_id = 0; //FIXME: is this OK ?
+
memset(req->header.addr1, 0xff, ETH_ALEN);
memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memset(req->header.addr3, 0xff, ETH_ALEN);
-
+
tag = (u8 *) skb_put(skb,len+2+rate_len);
-
+
*tag++ = MFIE_TYPE_SSID;
*tag++ = len;
memcpy(tag, ieee->current_network.ssid, len);
tag += len;
-
- ieee80211_MFIE_Brate(ieee,&tag);
- ieee80211_MFIE_Grate(ieee,&tag);
+
+ ieee80211_MFIE_Brate_rtl7(ieee,&tag);
+ ieee80211_MFIE_Grate_rtl7(ieee,&tag);
return skb;
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee);
-void ieee80211_send_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee);
+void ieee80211_send_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- unsigned long flags;
-
- skb = ieee80211_get_beacon_(ieee);
+
+ unsigned long flags;
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_beacons++;
}
- ieee->beacon_timer.expires = jiffies +
+ ieee->beacon_timer.expires = jiffies +
(MSECS( ieee->current_network.beacon_interval -5));
-
+
spin_lock_irqsave(&ieee->beacon_lock,flags);
if(ieee->beacon_txing)
add_timer(&ieee->beacon_timer);
@@ -279,57 +279,57 @@
}
-void ieee80211_send_beacon_cb(unsigned long _ieee)
+void ieee80211_send_beacon_cb_rtl7(unsigned long _ieee)
{
struct ieee80211_device *ieee =
(struct ieee80211_device *) _ieee;
- ieee80211_send_beacon(ieee);
+ ieee80211_send_beacon_rtl7(ieee);
}
-void ieee80211_send_probe(struct ieee80211_device *ieee)
+void ieee80211_send_probe_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
- skb = ieee80211_probe_req(ieee);
+
+ skb = ieee80211_probe_req_rtl7(ieee);
if (skb){
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->softmac_stats.tx_probe_rq++;
}
}
-void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
+void ieee80211_send_probe_requests_rtl7(struct ieee80211_device *ieee)
{
if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){
- ieee80211_send_probe(ieee);
- ieee80211_send_probe(ieee);
+ ieee80211_send_probe_rtl7(ieee);
+ ieee80211_send_probe_rtl7(ieee);
}
}
/* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked.
+ * in the allowed channel map has been checked.
*/
-void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_softmac_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
+
down(&ieee->scan_sem);
-
+
while(1)
{
-
+
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
goto out; /* scan completed */
-
+
}while(!ieee->channel_map[ch]);
-
+
/* this fuction can be called in two situations
* 1- We have switched to ad-hoc mode and we are
* performing a complete syncro scan before conclude
- * there are no interesting cell and to create a
- * new one. In this case the link state is
+ * there are no interesting cell and to create a
+ * new one. In this case the link state is
* IEEE80211_NOLINK until we found an interesting cell.
* If so the ieee8021_new_net, called by the RX path
* will set the state to IEEE80211_LINKED, so we stop
@@ -342,24 +342,24 @@
* not filter RX frames and the channel is changing.
* So the only situation in witch are interested is to check
* if the state become LINKED because of the #1 situation
- */
-
+ */
+
if (ieee->state == IEEE80211_LINKED)
goto out;
-
+
ieee->set_chan(ieee->dev, ch);
-
- ieee80211_send_probe_requests(ieee);
-
+
+ ieee80211_send_probe_requests_rtl7(ieee);
+
/* this prevent excessive time wait when we
* need to wait for a syncro scan to end..
- */
+ */
if (ieee->sync_scan_hurryup)
goto out;
msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME);
-
+
}
out:
ieee->sync_scan_hurryup = 0;
@@ -370,43 +370,49 @@
void ieee80211_softmac_scan(struct ieee80211_device *ieee)
{
short watchdog = 0;
-
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
return; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
schedule_work(&ieee->softmac_scan_wq);
}
#endif
-void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
-{
- down(&ieee->scan_sem);
-
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_softmac_scan_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+#else
+void ieee80211_softmac_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short watchdog = 0;
-
+ down(&ieee->scan_sem);
+
do{
- ieee->current_network.channel =
+ ieee->current_network.channel =
(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
- if (watchdog++ > MAX_CHANNEL_NUMBER)
+ if (watchdog++ > MAX_CHANNEL_NUMBER)
goto out; /* no good chans */
-
+
}while(!ieee->channel_map[ieee->current_network.channel]);
-
+
if (ieee->scanning == 0 )
goto out;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
- ieee80211_send_probe_requests(ieee);
+ ieee80211_send_probe_requests_rtl7(ieee);
-#if 0
+#if 0
ieee->.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME);
- if (ieee->scanning == 1)
+ if (ieee->scanning == 1)
add_timer(&ieee->scan_timer);
#endif
queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -419,7 +425,7 @@
{
unsigned long flags;
struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-
+
spin_lock_irqsave(&ieee->lock, flags);
ieee80211_softmac_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
@@ -427,19 +433,19 @@
#endif
-void ieee80211_beacons_start(struct ieee80211_device *ieee)
+void ieee80211_beacons_start_rtl7(struct ieee80211_device *ieee)
{
- unsigned long flags;
+ unsigned long flags;
spin_lock_irqsave(&ieee->beacon_lock,flags);
ieee->beacon_txing = 1;
- ieee80211_send_beacon(ieee);
-
+ ieee80211_send_beacon_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->beacon_lock,flags);
}
-void ieee80211_beacons_stop(struct ieee80211_device *ieee)
+void ieee80211_beacons_stop_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
@@ -453,111 +459,111 @@
}
-void ieee80211_stop_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_stop_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->stop_send_beacons)
ieee->stop_send_beacons(ieee->dev);
if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_stop(ieee);
+ ieee80211_beacons_stop_rtl7(ieee);
}
-void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
+void ieee80211_start_send_beacons_rtl7(struct ieee80211_device *ieee)
{
if(ieee->start_send_beacons)
ieee->start_send_beacons(ieee->dev);
if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
- ieee80211_beacons_start(ieee);
+ ieee80211_beacons_start_rtl7(ieee);
}
-void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_scan_rtl7(struct ieee80211_device *ieee)
{
-// unsigned long flags;
-
+// unsigned long flags;
+
//ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->scan_sem);
// spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->scanning == 1){
ieee->scanning = 0;
//del_timer_sync(&ieee->scan_timer);
cancel_delayed_work(&ieee->softmac_scan_wq);
}
-
+
// spin_unlock_irqrestore(&ieee->lock, flags);
up(&ieee->scan_sem);
}
-void ieee80211_stop_scan(struct ieee80211_device *ieee)
+void ieee80211_stop_scan_rtl7(struct ieee80211_device *ieee)
{
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_stop_scan(ieee);
+ ieee80211_softmac_stop_scan_rtl7(ieee);
else
ieee->stop_scan(ieee->dev);
}
/* called with ieee->lock held */
-void ieee80211_start_scan(struct ieee80211_device *ieee)
+void ieee80211_start_scan_rtl7(struct ieee80211_device *ieee)
{
- if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
if (ieee->scanning == 0){
ieee->scanning = 1;
//ieee80211_softmac_scan(ieee);
- queue_work(ieee->wq, &ieee->softmac_scan_wq);
+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
}
}else
ieee->start_scan(ieee->dev);
-
+
}
/* called with wx_sem held */
-void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
+void ieee80211_start_scan_syncro_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
- ieee80211_softmac_scan_syncro(ieee);
+ ieee80211_softmac_scan_syncro_rtl7(ieee);
else
ieee->scan_syncro(ieee->dev);
-
+
}
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
+inline struct sk_buff *ieee80211_authentication_req_rtl7(struct ieee80211_network *beacon,
struct ieee80211_device *ieee, int challengelen)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
-
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen);
+
if (!skb) return NULL;
-
+
auth = (struct ieee80211_authentication *)
skb_put(skb, sizeof(struct ieee80211_authentication));
-
+
auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-
+
auth->header.duration_id = 0x013a; //FIXME
-
+
memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-
+
auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
-
+
auth->transaction = cpu_to_le16(ieee->associate_seq);
ieee->associate_seq++;
-
+
auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-
+
return skb;
-
+
}
-static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest)
+static struct sk_buff* ieee80211_probe_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
u8 *tag;
int beacon_size;
@@ -566,23 +572,23 @@
int encrypt;
int atim_len,erp_len;
struct ieee80211_crypt_data* crypt;
-
+
char *ssid = ieee->current_network.ssid;
int ssid_len = ieee->current_network.ssid_len;
int rate_len = ieee->current_network.rates_len+2;
int rate_ex_len = ieee->current_network.rates_ex_len;
if(rate_ex_len > 0) rate_ex_len+=2;
-
+
if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
atim_len = 4;
else
atim_len = 0;
-
- if(ieee80211_is_54g(ieee->current_network))
+
+ if(ieee80211_is_54g_rtl7(ieee->current_network))
erp_len = 3;
else
erp_len = 0;
-
+
beacon_size = sizeof(struct ieee80211_probe_response)+
ssid_len
+3 //channel
@@ -590,72 +596,72 @@
+rate_ex_len
+atim_len
+erp_len;
-
+
skb = dev_alloc_skb(beacon_size);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size);
-
+
memcpy (beacon_buf->header.addr1, dest,ETH_ALEN);
memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
beacon_buf->header.duration_id = 0; //FIXME
- beacon_buf->beacon_interval =
+ beacon_buf->beacon_interval =
cpu_to_le16(ieee->current_network.beacon_interval);
- beacon_buf->capability =
+ beacon_buf->capability =
cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-
+
if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
- cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
-
+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
crypt = ieee->crypt[ieee->tx_keyidx];
- encrypt = ieee->host_encrypt && crypt && crypt->ops &&
+ encrypt = ieee->host_encrypt && crypt && crypt->ops &&
(0 == strcmp(crypt->ops->name, "WEP"));
- if (encrypt)
+ if (encrypt)
beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
-
+
+
beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-
- beacon_buf->info_element.id = MFIE_TYPE_SSID;
+
+ beacon_buf->info_element.id = MFIE_TYPE_SSID;
beacon_buf->info_element.len = ssid_len;
-
+
tag = (u8*) beacon_buf->info_element.data;
-
+
memcpy(tag, ssid, ssid_len);
-
+
tag += ssid_len;
-
+
*(tag++) = MFIE_TYPE_RATES;
- *(tag++) = rate_len-2;
+ *(tag++) = rate_len-2;
memcpy(tag,ieee->current_network.rates,rate_len-2);
tag+=rate_len-2;
-
+
*(tag++) = MFIE_TYPE_DS_SET;
*(tag++) = 1;
*(tag++) = ieee->current_network.channel;
-
+
if(atim_len){
*(tag++) = MFIE_TYPE_IBSS_SET;
*(tag++) = 2;
*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window);
tag+=2;
}
-
+
if(erp_len){
*(tag++) = MFIE_TYPE_ERP;
*(tag++) = 1;
- *(tag++) = 0;
+ *(tag++) = 0;
}
-
+
if(rate_ex_len){
*(tag++) = MFIE_TYPE_RATES_EX;
- *(tag++) = rate_ex_len-2;
+ *(tag++) = rate_ex_len-2;
memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
tag+=rate_ex_len-2;
}
@@ -664,208 +670,211 @@
}
-struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
+struct sk_buff* ieee80211_assoc_resp_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
struct sk_buff *skb;
u8* tag;
-
+
struct ieee80211_crypt_data* crypt;
struct ieee80211_assoc_response_frame *assoc;
short encrypt;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len;
-
- skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ skb = dev_alloc_skb(len);
+
+ if (!skb)
return NULL;
-
+
assoc = (struct ieee80211_assoc_response_frame *)
skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-
+
assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
memcpy(assoc->header.addr1, dest,ETH_ALEN);
memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
- assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-
-
+
+
if(ieee->short_slot)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
if (ieee->host_encrypt)
crypt = ieee->crypt[ieee->tx_keyidx];
else crypt = NULL;
-
+
encrypt = ( crypt && crypt->ops);
-
+
if (encrypt)
assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
assoc->status = 0;
assoc->aid = cpu_to_le16(ieee->assoc_id);
if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
else ieee->assoc_id++;
-
+
tag = (u8*) skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
return skb;
}
-struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest)
+struct sk_buff* ieee80211_auth_resp_rtl7(struct ieee80211_device *ieee,int status, u8 *dest)
{
struct sk_buff *skb;
struct ieee80211_authentication *auth;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1);
+
+ if (!skb)
return NULL;
-
+
skb->len = sizeof(struct ieee80211_authentication);
-
+
auth = (struct ieee80211_authentication *)skb->data;
-
+
auth->status = cpu_to_le16(status);
auth->transaction = cpu_to_le16(2);
auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-
+
memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(auth->header.addr1, dest, ETH_ALEN);
- auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
return skb;
-
-
+
+
}
-struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
+struct sk_buff* ieee80211_null_func_rtl7(struct ieee80211_device *ieee,short pwr)
{
struct sk_buff *skb;
struct ieee80211_hdr_3addr* hdr;
-
- skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
-
- if (!skb)
+
+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-
+
memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-
- hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
- IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
- (pwr ? IEEE80211_FCTL_PM:0));
-
+
+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+ (pwr ? IEEE80211_FCTL_PM:0));
+
return skb;
-
-
+
+
}
-void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
+void ieee80211_resp_to_assoc_rq_rtl7(struct ieee80211_device *ieee, u8* dest)
{
- struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-
+ struct sk_buff *buf = ieee80211_assoc_resp_rtl7(ieee, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
+void ieee80211_resp_to_auth_rtl7(struct ieee80211_device *ieee, int s, u8* dest)
{
- struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-
+ struct sk_buff *buf = ieee80211_auth_resp_rtl7(ieee, s, dest);
+
if (buf)
- softmac_mgmt_xmit(buf, ieee);
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
+void ieee80211_resp_to_probe_rtl7(struct ieee80211_device *ieee, u8 *dest)
{
-
- struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-
- if (buf)
- softmac_mgmt_xmit(buf, ieee);
+
+ struct sk_buff *buf = ieee80211_probe_resp_rtl7(ieee, dest);
+
+ if (buf)
+ softmac_mgmt_xmit_rtl7(buf, ieee);
}
-inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
+inline struct sk_buff *ieee80211_association_req_rtl7(struct ieee80211_network *beacon,struct ieee80211_device *ieee)
{
struct sk_buff *skb;
-
+
struct ieee80211_assoc_request_frame *hdr;
u8 *tag;
-
+
unsigned int wpa_len = beacon->wpa_ie_len;
-
- unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
-
-
-
+
+ unsigned int rate_len = ieee80211_MFIE_rate_len_rtl7(ieee);
+
+
+
int len=sizeof(struct ieee80211_assoc_request_frame)+
+ beacon->ssid_len//essid tagged val
+ rate_len//rates tagged val
+ wpa_len;
-
+
skb = dev_alloc_skb(len);
-
- if (!skb)
+
+ if (!skb)
return NULL;
-
+
hdr = (struct ieee80211_assoc_request_frame *)
skb_put(skb, sizeof(struct ieee80211_assoc_request_frame));
-
-
+
+
hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
hdr->header.duration_id= 37; //FIXME
memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
-
+
hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
- if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-
+
if(ieee->short_slot)
hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-
+
+ if(beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE);
+
hdr->listen_interval = 0xa; //FIXME
-
+
hdr->info_element.id = MFIE_TYPE_SSID;
hdr->info_element.len = beacon->ssid_len;
tag = skb_put(skb, beacon->ssid_len);
memcpy(tag, beacon->ssid, beacon->ssid_len);
-
- tag = skb_put(skb, rate_len);
-
- ieee80211_MFIE_Brate(ieee, &tag);
- ieee80211_MFIE_Grate(ieee, &tag);
-
+
+ tag = skb_put(skb, rate_len);
+
+ ieee80211_MFIE_Brate_rtl7(ieee, &tag);
+ ieee80211_MFIE_Grate_rtl7(ieee, &tag);
+
tag = skb_put(skb,wpa_len);
-
+
memcpy(tag,beacon->wpa_ie,wpa_len);
-
+
return skb;
}
-void ieee80211_associate_abort(struct ieee80211_device *ieee)
+void ieee80211_associate_abort_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags);
-
+
ieee->associate_seq++;
-
+
/* don't scan, and avoid to have the RX path possibily
* try again to associate. Even do not react to AUTH or
* ASSOC response. Just wait for the retry wq to be scheduled.
@@ -873,166 +882,181 @@
* with, so we retry or just get back to NO_LINK and scanning
*/
if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
- IEEE80211_DEBUG_MGMT("Authentication failed\n");
+ IEEE80211_DEBUG_MGMT("Authentication failed\n");
ieee->softmac_stats.no_auth_rs++;
}else{
- IEEE80211_DEBUG_MGMT("Association failed\n");
+ IEEE80211_DEBUG_MGMT("Association failed\n");
ieee->softmac_stats.no_ass_rs++;
}
-
+
ieee->state = IEEE80211_ASSOCIATING_RETRY;
-
+
queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
-void ieee80211_associate_abort_cb(unsigned long dev)
+void ieee80211_associate_abort_cb_rtl7(unsigned long dev)
{
- ieee80211_associate_abort((struct ieee80211_device *) dev);
+ ieee80211_associate_abort_rtl7((struct ieee80211_device *) dev);
}
-void ieee80211_associate_step1(struct ieee80211_device *ieee)
+void ieee80211_associate_step1_rtl7(struct ieee80211_device *ieee)
{
struct ieee80211_network *beacon = &ieee->current_network;
struct sk_buff *skb;
-
+
IEEE80211_DEBUG_MGMT("Stopping scan\n");
-
+
ieee->softmac_stats.tx_auth_rq++;
- skb=ieee80211_authentication_req(beacon, ieee, 0);
-
- if (!skb)
- ieee80211_associate_abort(ieee);
- else{
+ skb=ieee80211_authentication_req_rtl7(beacon, ieee, 0);
+
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
+ else{
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
IEEE80211_DEBUG_MGMT("Sending authentication request\n");
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
+void ieee80211_auth_challenge_rtl7(struct ieee80211_device *ieee, u8 *challenge, int chlen)
{
- u8 *c;
+ u8 *c;
struct sk_buff *skb;
struct ieee80211_network *beacon = &ieee->current_network;
// int hlen = sizeof(struct ieee80211_authentication);
-
+
ieee->associate_seq++;
ieee->softmac_stats.tx_auth_rq++;
-
- skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
- if (!skb)
- ieee80211_associate_abort(ieee);
+
+ skb = ieee80211_authentication_req_rtl7(beacon, ieee, chlen+2);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
c = skb_put(skb, chlen+2);
*(c++) = MFIE_TYPE_CHALLENGE;
*(c++) = chlen;
memcpy(c, challenge, chlen);
-
+
IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-
- ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
-
- softmac_mgmt_xmit(skb, ieee);
+
+ ieee80211_encrypt_fragment_rtl7(ieee, skb, sizeof(struct ieee80211_hdr_3addr ));
+
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
kfree(challenge);
}
-void ieee80211_associate_step2(struct ieee80211_device *ieee)
+void ieee80211_associate_step2_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff* skb;
struct ieee80211_network *beacon = &ieee->current_network;
-
+
del_timer_sync(&ieee->associate_timer);
-
+
IEEE80211_DEBUG_MGMT("Sending association request\n");
-
+
ieee->softmac_stats.tx_ass_rq++;
- skb=ieee80211_association_req(beacon, ieee);
- if (!skb)
- ieee80211_associate_abort(ieee);
+ skb=ieee80211_association_req_rtl7(beacon, ieee);
+ if (!skb)
+ ieee80211_associate_abort_rtl7(ieee);
else{
- softmac_mgmt_xmit(skb, ieee);
+ softmac_mgmt_xmit_rtl7(skb, ieee);
ieee->associate_timer.expires = jiffies + (HZ / 2);
add_timer(&ieee->associate_timer);
- }
+ }
}
-void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_complete_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+#else
+void ieee80211_associate_complete_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
printk(KERN_INFO "Associated successfully\n");
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-
+
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
}else{
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
+ notify_wx_assoc_event_rtl7(ieee);
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
netif_carrier_on(ieee->dev);
}
-void ieee80211_associate_complete(struct ieee80211_device *ieee)
+void ieee80211_associate_complete_rtl7(struct ieee80211_device *ieee)
{
del_timer_sync(&ieee->associate_timer);
-
+
ieee->seq_ctrl = 0;
ieee->state = IEEE80211_LINKED;
IEEE80211_DEBUG_MGMT("Successfully associated\n");
-
+
queue_work(ieee->wq, &ieee->associate_complete_wq);
}
-void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_procedure_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+#else
+void ieee80211_associate_procedure_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
-
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_scan(ieee);
+
+ ieee80211_stop_scan_rtl7(ieee);
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
ieee->associate_seq = 1;
- ieee80211_associate_step1(ieee);
-
+ ieee80211_associate_step1_rtl7(ieee);
+
up(&ieee->wx_sem);
}
-inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net)
+inline void ieee80211_softmac_new_net_rtl7(struct ieee80211_device *ieee, struct ieee80211_network *net)
{
-
+
u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
int tmp_ssid_len = 0;
-
+
short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-
- /* we are interested in new new only if we are not associated
+
+ /* we are interested in new new only if we are not associated
* and we are not associating / authenticating
*/
if (ieee->state != IEEE80211_NOLINK)
- return;
-
+ return;
+
if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
return;
-
+
if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
return;
-
+
if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
/* if the user specified the AP MAC, we need also the essid
* This could be obtained by beacons or, if the network does not
@@ -1043,23 +1067,23 @@
ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0');
apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-
-
-
+
+
+
if ( /* if the user set the AP check if match.
* if the network does not broadcast essid we check the user supplyed ANY essid
* if the network does broadcast and the user does not set essid it is OK
* if the network does broadcast and the user did set essid chech if essid match
*/
- ( apset && apmatch &&
- ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
+ ( apset && apmatch &&
+ ((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
/* if the ap is not set, check that the user set the bssid
* and the network does bradcast and that those two bssid matches
- */
- (!apset && ssidset && ssidbroad && ssidmatch)
+ */
+ (!apset && ssidset && ssidbroad && ssidmatch)
){
-
-
+
+
/* if the essid is hidden replace it with the
* essid provided by the user.
*/
@@ -1068,18 +1092,19 @@
tmp_ssid_len = ieee->current_network.ssid_len;
}
memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-
+
if (!ssidbroad){
strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
ieee->current_network.ssid_len = tmp_ssid_len;
}
- printk(KERN_INFO"Linking with %s\n",ieee->current_network.ssid);
-
+ printk(KERN_INFO"Linking with \"%s\" rate: %d MBit\n",ieee->current_network.ssid, (ieee->rate/10));
+
if (ieee->iw_mode == IW_MODE_INFRA){
ieee->state = IEEE80211_ASSOCIATING;
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}else{
- if(ieee80211_is_54g(ieee->current_network) &&
+#if 0
+ if(ieee80211_is_54g_rtl7(ieee->current_network) &&
(ieee->modulation & IEEE80211_OFDM_MODULATION)){
ieee->rate = 540;
printk(KERN_INFO"Using G rates\n");
@@ -1087,44 +1112,45 @@
ieee->rate = 110;
printk(KERN_INFO"Using B rates\n");
}
+#else
+ printk(KERN_INFO"Using %d MBit\n", (ieee->rate/10) );
+#endif
ieee->state = IEEE80211_LINKED;
}
-
+
}
}
-
}
-void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
+void ieee80211_softmac_check_all_nets_rtl7(struct ieee80211_device *ieee)
{
-
+
unsigned long flags;
struct ieee80211_network *target;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
list_for_each_entry(target, &ieee->network_list, list) {
-
+
/* if the state become different that NOLINK means
* we had found what we are searching for
*/
- if (ieee->state != IEEE80211_NOLINK)
+ if (ieee->state != IEEE80211_NOLINK)
break;
-
+
//if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
- ieee80211_softmac_new_net(ieee, target);
+ ieee80211_softmac_new_net_rtl7(ieee, target);
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
+static inline u16 auth_parse_rtl7(struct sk_buff *skb, u8** challenge, int *chlen)
{
struct ieee80211_authentication *a;
u8 *t;
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
return 0xcafe;
}
@@ -1132,58 +1158,58 @@
a = (struct ieee80211_authentication*) skb->data;
if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
t = skb->data + sizeof(struct ieee80211_authentication);
-
+
if(*(t++) == MFIE_TYPE_CHALLENGE){
*chlen = *(t++);
*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
memcpy(*challenge, t, *chlen);
}
}
-
+
return cpu_to_le16(a->status);
-
+
}
-int auth_rq_parse(struct sk_buff *skb,u8* dest)
+int auth_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_authentication *a;
-
- if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
- IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
+
+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
return -1;
}
a = (struct ieee80211_authentication*) skb->data;
-
+
memcpy(dest,a->header.addr2, ETH_ALEN);
-
- if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
+
+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-
+
return WLAN_STATUS_SUCCESS;
}
-static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
+static short probe_rq_parse_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src)
{
u8 *tag;
u8 *skbend;
u8 *ssid=NULL;
u8 ssidlen = 0;
-
+
struct ieee80211_hdr_3addr *header =
(struct ieee80211_hdr_3addr *) skb->data;
-
- if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
+
+ if (skb->len < sizeof (struct ieee80211_hdr_3addr ))
return -1; /* corrupted */
-
+
memcpy(src,header->addr2, ETH_ALEN);
-
+
skbend = (u8*)skb->data + skb->len;
-
+
tag = skb->data + sizeof (struct ieee80211_hdr_3addr );
-
+
while (tag+1 < skbend){
- if (*tag == 0){
+ if (*tag == 0){
ssid = tag+2;
ssidlen = *(tag+1);
break;
@@ -1192,88 +1218,88 @@
tag = tag + *(tag); /* point to the last data byte of the tag */
tag++; /* point to the next tag */
}
-
+
//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
if (ssidlen == 0) return 1;
-
+
if (!ssid) return 1; /* ssid not found in tagged param */
return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-
+
}
-int assoc_rq_parse(struct sk_buff *skb,u8* dest)
+int assoc_rq_parse_rtl7(struct sk_buff *skb,u8* dest)
{
struct ieee80211_assoc_request_frame *a;
-
- if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
- sizeof(struct ieee80211_info_element))) {
-
+
+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+ sizeof(struct ieee80211_info_element))) {
+
IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
return -1;
}
-
+
a = (struct ieee80211_assoc_request_frame*) skb->data;
-
+
memcpy(dest,a->header.addr2,ETH_ALEN);
-
+
return 0;
}
-static inline u16 assoc_parse(struct sk_buff *skb, int *aid)
+static inline u16 assoc_parse_rtl7(struct sk_buff *skb, int *aid)
{
struct ieee80211_assoc_response_frame *a;
- if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){
IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
return 0xcafe;
}
-
+
a = (struct ieee80211_assoc_response_frame*) skb->data;
*aid = le16_to_cpu(a->aid) & 0x3fff;
return le16_to_cpu(a->status);
}
static inline void
-ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_probe_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
-
+
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_probe_rq++;
//DMESG("Dest is "MACSTR, MAC2STR(dest));
- if (probe_rq_parse(ieee, skb, dest)){
+ if (probe_rq_parse_rtl7(ieee, skb, dest)){
//IEEE80211DMESG("Was for me!");
ieee->softmac_stats.tx_probe_rs++;
- ieee80211_resp_to_probe(ieee, dest);
+ ieee80211_resp_to_probe_rtl7(ieee, dest);
}
}
static inline void
-ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_auth_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
u8 dest[ETH_ALEN];
int status;
//IEEE80211DMESG("Rx probe");
ieee->softmac_stats.rx_auth_rq++;
-
- if ((status = auth_rq_parse(skb, dest))!= -1){
- ieee80211_resp_to_auth(ieee, status, dest);
+
+ if ((status = auth_rq_parse_rtl7(skb, dest))!= -1){
+ ieee80211_resp_to_auth_rtl7(ieee, status, dest);
}
//DMESG("Dest is "MACSTR, MAC2STR(dest));
-
+
}
static inline void
-ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
+ieee80211_rx_assoc_rq_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb)
{
-
+
u8 dest[ETH_ALEN];
//unsigned long flags;
-
+
ieee->softmac_stats.rx_ass_rq++;
- if (assoc_rq_parse(skb,dest) != -1){
- ieee80211_resp_to_assoc_rq(ieee, dest);
+ if (assoc_rq_parse_rtl7(skb,dest) != -1){
+ ieee80211_resp_to_assoc_rq_rtl7(ieee, dest);
}
-
+
printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
//FIXME
#if 0
@@ -1285,25 +1311,25 @@
-void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
+void ieee80211_sta_ps_send_null_frame_rtl7(struct ieee80211_device *ieee, short pwr)
{
-
- struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-
+
+ struct sk_buff *buf = ieee80211_null_func_rtl7(ieee, pwr);
+
if (buf)
- softmac_ps_mgmt_xmit(buf, ieee);
+ softmac_ps_mgmt_xmit_rtl7(buf, ieee);
-}
+}
-short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{
+short ieee80211_sta_ps_sleep_rtl7(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
+{
int timeout = ieee->ps_timeout;
u8 dtim;
/*if(ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)
-
+
return 0;
*/
dtim = ieee->current_network.dtim_data;
@@ -1312,133 +1338,133 @@
return 0;
//printk("VALID\n");
ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-
+
if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
return 2;
-
+
if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
return 0;
-
+
if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
return 0;
-
+
if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
return 0;
-
+
if(time_l){
- *time_l = ieee->current_network.last_dtim_sta_time[0]
- + (ieee->current_network.beacon_interval
+ *time_l = ieee->current_network.last_dtim_sta_time[0]
+ + (ieee->current_network.beacon_interval
* ieee->current_network.dtim_period) * 1000;
}
-
+
if(time_h){
*time_h = ieee->current_network.last_dtim_sta_time[1];
if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
*time_h += 1;
}
-
+
return 1;
-
-
+
+
}
-inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
+inline void ieee80211_sta_ps_rtl7(struct ieee80211_device *ieee)
{
u32 th,tl;
short sleep;
-
+
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if((ieee->ps == IEEE80211_PS_DISABLED ||
- ieee->iw_mode != IW_MODE_INFRA ||
+ ieee->iw_mode != IW_MODE_INFRA ||
ieee->state != IEEE80211_LINKED)){
-
- #warning CHECK_LOCK_HERE
+
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee, 1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee, 1);
+ printk(KERN_WARNING "wakeup 1!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-
- sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
+
+ sleep = ieee80211_sta_ps_sleep_rtl7(ieee,&th, &tl);
/* 2 wake, 1 sleep, 0 do nothing */
if(sleep == 0)
goto out;
-
+
if(sleep == 1){
-
+
if(ieee->sta_sleep == 1)
ieee->enter_sleep_state(ieee->dev,th,tl);
-
+
else if(ieee->sta_sleep == 0){
// printk("send null 1\n");
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
+
if(ieee->ps_is_queue_empty(ieee->dev)){
-
-
+
+
ieee->sta_sleep = 2;
-
+
ieee->ps_request_tx_ack(ieee->dev);
-
- ieee80211_sta_ps_send_null_frame(ieee,1);
-
+
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee,1);
+
ieee->ps_th = th;
ieee->ps_tl = tl;
- }
+ }
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-
+
}
-
-
+
+
}else if(sleep == 2){
-#warning CHECK_LOCK_HERE
+// #warning CHECK_LOCK_HERE
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-
- ieee80211_sta_wakeup(ieee,1);
-
+
+ ieee80211_sta_wakeup_rtl7(ieee,1);
+ printk(KERN_WARNING "wakeup 2!\n" );
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
-out:
+out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
}
-void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
+void ieee80211_sta_wakeup_rtl7(struct ieee80211_device *ieee, short nl)
{
if(ieee->sta_sleep == 0){
if(nl){
printk("Warning: driver is probably failing to report TX ps error\n");
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
return;
-
+
}
-
- if(ieee->sta_sleep == 1)
+
+ if(ieee->sta_sleep == 1)
ieee->sta_wake_up(ieee->dev);
-
+
ieee->sta_sleep = 0;
-
+
if(nl){
ieee->ps_request_tx_ack(ieee->dev);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
}
}
-void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
+void ieee80211_ps_tx_ack_rtl7(struct ieee80211_device *ieee, short success)
{
unsigned long flags,flags2;
-
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->sta_sleep == 2){
/* Null frame with PS bit set */
if(success){
@@ -1451,10 +1477,10 @@
}
/* 21112005 - tx again null without PS bit if lost */
else {
-
+
if((ieee->sta_sleep == 0) && !success){
spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
- ieee80211_sta_ps_send_null_frame(ieee, 0);
+ ieee80211_sta_ps_send_null_frame_rtl7(ieee, 0);
spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
}
}
@@ -1462,129 +1488,132 @@
}
inline int
-ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
+ieee80211_rx_frame_softmac_rtl7(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_rx_stats *rx_stats, u16 type,
u16 stype)
{
struct ieee80211_hdr_3addr *header;
- header = (struct ieee80211_hdr_3addr *) skb->data;
u16 errcode;
u8* challenge;
int chlen;
int aid;
-
+
+ chlen = 0;
+
+ header = (struct ieee80211_hdr_3addr *) skb->data;
+
if(!ieee->proto_started)
return 0;
-
+
if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
- ieee->iw_mode == IW_MODE_INFRA &&
+ ieee->iw_mode == IW_MODE_INFRA &&
ieee->state == IEEE80211_LINKED))
-
+
tasklet_schedule(&ieee->ps_task);
-
+
if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
ieee->last_rx_ps_time = jiffies;
-
+
switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-
+
case IEEE80211_STYPE_ASSOC_RESP:
case IEEE80211_STYPE_REASSOC_RESP:
-
+
IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
WLAN_FC_GET_STYPE(header->frame_ctl));
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
ieee->iw_mode == IW_MODE_INFRA){
- if (0 == (errcode=assoc_parse(skb, &aid))){
-
+ if (0 == (errcode=assoc_parse_rtl7(skb, &aid))){
+
ieee->state=IEEE80211_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
-
- ieee80211_associate_complete(ieee);
+
+ ieee80211_associate_complete_rtl7(ieee);
}else{
ieee->softmac_stats.rx_ass_err++;
IEEE80211_DEBUG_MGMT(
"Association response status code 0x%x\n",
errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
}
break;
-
+
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
-
+
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
ieee->iw_mode == IW_MODE_MASTER)
-
- ieee80211_rx_assoc_rq(ieee, skb);
+
+ ieee80211_rx_assoc_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_AUTH:
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
- if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
IEEE80211_DEBUG_MGMT("Received authentication response");
-
- if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
+
+ if (0 == (errcode=auth_parse_rtl7(skb, &challenge, &chlen))){
if(ieee->open_wep || !challenge){
ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
ieee->softmac_stats.rx_auth_rs_ok++;
-
- ieee80211_associate_step2(ieee);
+
+ ieee80211_associate_step2_rtl7(ieee);
}else{
- ieee80211_auth_challenge(ieee, challenge, chlen);
+ ieee80211_auth_challenge_rtl7(ieee, challenge, chlen);
}
}else{
ieee->softmac_stats.rx_auth_rs_err++;
IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
- ieee80211_associate_abort(ieee);
+ ieee80211_associate_abort_rtl7(ieee);
}
-
+
}else if (ieee->iw_mode == IW_MODE_MASTER){
- ieee80211_rx_auth_rq(ieee, skb);
+ ieee80211_rx_auth_rq_rtl7(ieee, skb);
}
}
break;
-
+
case IEEE80211_STYPE_PROBE_REQ:
-
- if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
- ((ieee->iw_mode == IW_MODE_ADHOC ||
+
+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+ ((ieee->iw_mode == IW_MODE_ADHOC ||
ieee->iw_mode == IW_MODE_MASTER) &&
ieee->state == IEEE80211_LINKED))
-
- ieee80211_rx_probe_rq(ieee, skb);
+
+ ieee80211_rx_probe_rq_rtl7(ieee, skb);
break;
-
+
case IEEE80211_STYPE_DISASSOC:
case IEEE80211_STYPE_DEAUTH:
- /* FIXME for now repeat all the association procedure
+ /* FIXME for now repeat all the association procedure
* both for disassociation and deauthentication
*/
if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
- ieee->state == IEEE80211_LINKED &&
+ ieee->state == IEEE80211_LINKED &&
ieee->iw_mode == IW_MODE_INFRA){
-
+
ieee->state = IEEE80211_ASSOCIATING;
ieee->softmac_stats.reassoc++;
-
- notify_wx_assoc_event(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
queue_work(ieee->wq, &ieee->associate_procedure_wq);
}
-
+
break;
-
- default:
+
+ default:
return -1;
break;
}
-
+
//dev_kfree_skb_any(skb);
return 0;
}
@@ -1602,21 +1631,21 @@
* This might be useful if each fragment need it's own
* descriptor, thus just keep a total free memory > than
* the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed
- * to keep N free descriptors where
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
* N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
* In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to
+ * will take care of buffering fragments and pass them to
* to the driver later, when it wakes the queue.
- */
-
-void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
+ */
+
+void ieee80211_softmac_xmit_rtl7(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
{
-
-
+
+
unsigned long flags;
int i;
-
+
spin_lock_irqsave(&ieee->lock,flags);
#if 0
if(ieee->queue_stop){
@@ -1627,13 +1656,13 @@
err = 1;
goto exit;
}
-
+
ieee->stats.tx_bytes+=skb->len;
-
-
+
+
txb=ieee80211_skb_to_txb(ieee,skb);
-
-
+
+
if(txb==NULL){
IEEE80211DMESG("WW: IEEE stack failed to provide txb");
//dev_kfree_skb_any(skb);
@@ -1641,12 +1670,12 @@
goto exit;
}
#endif
-
+
/* called with 2nd parm 0, no tx mgmt lock required */
- ieee80211_sta_wakeup(ieee,0);
+ ieee80211_sta_wakeup_rtl7(ieee,0);
for(i = 0; i < txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.txb = txb;
ieee->tx_pending.frag = i;
@@ -1658,29 +1687,29 @@
//(i+1)<txb->nr_frags);
ieee->stats.tx_packets++;
ieee->stats.tx_bytes += txb->fragments[i]->len;
- ieee->dev->trans_start = jiffies;
+ ieee->dev->trans_start = jiffies;
}
- }
-
- ieee80211_txb_free(txb);
-
+ }
+
+ ieee80211_txb_free_rtl7(txb);
+
exit:
spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
/* called with ieee->lock acquired */
-void ieee80211_resume_tx(struct ieee80211_device *ieee)
+void ieee80211_resume_tx_rtl7(struct ieee80211_device *ieee)
{
int i;
for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-
+
if (ieee->queue_stop){
ieee->tx_pending.frag = i;
return;
}else{
-
- ieee->softmac_data_hard_start_xmit(
+
+ ieee->softmac_data_hard_start_xmit(
ieee->tx_pending.txb->fragments[i],
ieee->dev,ieee->rate);
//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -1688,21 +1717,21 @@
ieee->dev->trans_start = jiffies;
}
}
-
-
- ieee80211_txb_free(ieee->tx_pending.txb);
+
+
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
-void ieee80211_reset_queue(struct ieee80211_device *ieee)
+void ieee80211_reset_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
-
+
spin_lock_irqsave(&ieee->lock,flags);
- init_mgmt_queue(ieee);
+ init_mgmt_queue_rtl7(ieee);
if (ieee->tx_pending.txb){
- ieee80211_txb_free(ieee->tx_pending.txb);
+ ieee80211_txb_free_rtl7(ieee->tx_pending.txb);
ieee->tx_pending.txb = NULL;
}
ieee->queue_stop = 0;
@@ -1710,23 +1739,23 @@
}
-void ieee80211_wake_queue(struct ieee80211_device *ieee)
+void ieee80211_wake_queue_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
struct sk_buff *skb;
struct ieee80211_hdr_3addr *header;
-
+
spin_lock_irqsave(&ieee->lock,flags);
if (! ieee->queue_stop) goto exit;
-
+
ieee->queue_stop = 0;
-
+
if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
- while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-
+ while (!ieee->queue_stop && (skb = dequeue_mgmt_rtl7(ieee))){
+
header = (struct ieee80211_hdr_3addr *) skb->data;
-
+
header->seq_ctl = cpu_to_le16(ieee->seq_ctrl << 4);
if (ieee->seq_ctrl == 0xFFF)
@@ -1738,19 +1767,19 @@
}
}
if (!ieee->queue_stop && ieee->tx_pending.txb)
- ieee80211_resume_tx(ieee);
-
+ ieee80211_resume_tx_rtl7(ieee);
+
if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
ieee->softmac_stats.swtxawake++;
netif_wake_queue(ieee->dev);
}
-
+
exit :
spin_unlock_irqrestore(&ieee->lock,flags);
}
-void ieee80211_stop_queue(struct ieee80211_device *ieee)
+void ieee80211_stop_queue_rtl7(struct ieee80211_device *ieee)
{
//unsigned long flags;
//spin_lock_irqsave(&ieee->lock,flags);
@@ -1761,81 +1790,88 @@
}
ieee->queue_stop = 1;
//spin_unlock_irqrestore(&ieee->lock,flags);
-
+
}
-inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
+inline void ieee80211_randomize_cell_rtl7(struct ieee80211_device *ieee)
{
-
+
get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-
+
/* an IBSS cell address must have the two less significant
- * bits of the first byte = 2
+ * bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
}
/* called in user context only */
-void ieee80211_start_master_bss(struct ieee80211_device *ieee)
+void ieee80211_start_master_bss_rtl7(struct ieee80211_device *ieee)
{
ieee->assoc_id = 1;
-
+
if (ieee->current_network.ssid_len == 0){
- strncpy(ieee->current_network.ssid,
+ strncpy(ieee->current_network.ssid,
IEEE80211_DEFAULT_TX_ESSID,
IW_ESSID_MAX_SIZE);
-
+
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
}
-
+
memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
-void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
+void ieee80211_start_monitor_mode_rtl7(struct ieee80211_device *ieee)
{
if(ieee->raw_tx){
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
}
}
-void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_start_ibss_wq_rtl7(struct work_struct *work)
+{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, start_ibss_wq);
+#else
+void ieee80211_start_ibss_wq_rtl7(struct ieee80211_device *ieee)
{
-
+#endif
+
/* iwconfig mode ad-hoc will schedule this and return
* on the other hand this will block further iwconfig SET
* operations because of the wx_sem hold.
* Anyway some most set operations set a flag to speed-up
- * (abort) this wq (when syncro scanning) before sleeping
+ * (abort) this wq (when syncro scanning) before sleeping
* on the semaphore
*/
-
+
down(&ieee->wx_sem);
-
+
if (ieee->current_network.ssid_len == 0){
strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
ieee->ssid_set = 1;
- }
-
+ }
+
/* check if we have this cell in our network list */
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* if not then the state is not linked. Maybe the user swithced to
* ad-hoc mode just after being in monitor mode, or just after
* being very few time in managed mode (so the card have had no
@@ -1851,29 +1887,29 @@
* associated.
*/
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan_syncro(ieee);
+ ieee80211_start_scan_syncro_rtl7(ieee);
/* the network definitively is not here.. create a new cell */
if (ieee->state == IEEE80211_NOLINK){
- printk("creating new IBSS cell\n");
+ printk("creating new IBSS cell\n");
if(!ieee->wap_set)
- ieee80211_randomize_cell(ieee);
-
+ ieee80211_randomize_cell_rtl7(ieee);
+
if(ieee->modulation & IEEE80211_CCK_MODULATION){
-
+
ieee->current_network.rates_len = 4;
-
+
ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-
+
}else
ieee->current_network.rates_len = 0;
-
+
if(ieee->modulation & IEEE80211_OFDM_MODULATION){
ieee->current_network.rates_ex_len = 8;
-
+
ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -1882,44 +1918,44 @@
ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
- ieee->rate = 540;
+
+// ieee->rate = 540;
}else{
ieee->current_network.rates_ex_len = 0;
- ieee->rate = 110;
+// ieee->rate = 110;
}
-
+
ieee->current_network.atim_window = 0;
ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
if(ieee->short_slot)
ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-
+
}
-
+
ieee->state = IEEE80211_LINKED;
-
+
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->link_change(ieee->dev);
-
- notify_wx_assoc_event(ieee);
-
- ieee80211_start_send_beacons(ieee);
-
+
+ notify_wx_assoc_event_rtl7(ieee);
+
+ ieee80211_start_send_beacons_rtl7(ieee);
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
}
-inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
+inline void ieee80211_start_ibss_rtl7(struct ieee80211_device *ieee)
{
queue_work(ieee->wq, &ieee->start_ibss_wq);
}
/* this is called only in user context, with wx_sem held */
-void ieee80211_start_bss(struct ieee80211_device *ieee)
+void ieee80211_start_bss_rtl7(struct ieee80211_device *ieee)
{
unsigned long flags;
/* check if we have already found the net we
@@ -1927,8 +1963,8 @@
* if not (we are disassociated and we are not
* in associating / authenticating phase) start the background scanning.
*/
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
/* ensure no-one start an associating process (thus setting
* the ieee->state to ieee80211_ASSOCIATING) while we
* have just cheked it and we are going to enable scan.
@@ -1937,41 +1973,49 @@
* the rx path), so we cannot be in the middle of such function
*/
spin_lock_irqsave(&ieee->lock, flags);
-
if (ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
}
/* called only in userspace context */
-void ieee80211_disassociate(struct ieee80211_device *ieee)
+void ieee80211_disassociate_rtl7(struct ieee80211_device *ieee)
{
netif_carrier_off(ieee->dev);
-
+
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
- ieee80211_reset_queue(ieee);
-
+ ieee80211_reset_queue_rtl7(ieee);
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
+
ieee->state = IEEE80211_NOLINK;
ieee->link_change(ieee->dev);
- notify_wx_assoc_event(ieee);
-
+ notify_wx_assoc_event_rtl7(ieee);
+
}
-void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
+
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_associate_retry_wq_rtl7(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+#else
+void ieee80211_associate_retry_wq_rtl7(struct ieee80211_device *ieee)
{
+#endif
unsigned long flags;
-
+
down(&ieee->wx_sem);
+
if(!ieee->proto_started)
goto exit;
-
+
if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
goto exit;
-
- /* until we do not set the state to IEEE80211_NOLINK
+
+ /* until we do not set the state to IEEE80211_NOLINK
* there are no possibility to have someone else trying
* to start an association procdure (we get here with
* ieee->state = IEEE80211_ASSOCIATING).
@@ -1981,122 +2025,120 @@
* RX path works with ieee->lock held so there are no
* problems. If we are still disassociated then start a scan.
* the lock here is necessary to ensure no one try to start
- * an association procedure when we have just checked the
+ * an association procedure when we have just checked the
* state and we are going to start the scan.
*/
ieee->state = IEEE80211_NOLINK;
- ieee80211_softmac_check_all_nets(ieee);
-
+ ieee80211_softmac_check_all_nets_rtl7(ieee);
+
spin_lock_irqsave(&ieee->lock, flags);
-
+
if(ieee->state == IEEE80211_NOLINK)
- ieee80211_start_scan(ieee);
-
+ ieee80211_start_scan_rtl7(ieee);
+
spin_unlock_irqrestore(&ieee->lock, flags);
exit:
up(&ieee->wx_sem);
}
-struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon__rtl7(struct ieee80211_device *ieee)
{
u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
+
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_probe_resp(ieee, broadcast_addr);
-
- if (!skb)
+
+ skb = ieee80211_probe_resp_rtl7(ieee, broadcast_addr);
+
+ if (!skb)
return NULL;
-
+
b = (struct ieee80211_probe_response *) skb->data;
b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-
+
return skb;
-
+
}
-struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
+struct sk_buff *ieee80211_get_beacon_rtl7(struct ieee80211_device *ieee)
{
struct sk_buff *skb;
struct ieee80211_probe_response *b;
-
- skb = ieee80211_get_beacon_(ieee);
- if(!skb)
+
+ skb = ieee80211_get_beacon__rtl7(ieee);
+ if(!skb)
return NULL;
-
- b = (struct ieee80211_probe_response *) skb->data;
+
+ b = (struct ieee80211_probe_response *) skb->data;
b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl << 4);
-
+
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
-
+
return skb;
}
-void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 1;
down(&ieee->wx_sem);
- ieee80211_stop_protocol(ieee);
+
+ ieee80211_stop_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_stop_protocol(struct ieee80211_device *ieee)
+void ieee80211_stop_protocol_rtl7(struct ieee80211_device *ieee)
{
if (!ieee->proto_started)
return;
-
+
ieee->proto_started = 0;
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
del_timer_sync(&ieee->associate_timer);
- cancel_delayed_work(&ieee->associate_retry_wq);
-
- ieee80211_stop_scan(ieee);
+ cancel_delayed_work(&ieee->associate_retry_wq);
+
+ ieee80211_stop_scan_rtl7(ieee);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_softmac_start_protocol_rtl7(struct ieee80211_device *ieee)
{
ieee->sync_scan_hurryup = 0;
down(&ieee->wx_sem);
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
up(&ieee->wx_sem);
}
-void ieee80211_start_protocol(struct ieee80211_device *ieee)
+void ieee80211_start_protocol_rtl7(struct ieee80211_device *ieee)
{
short ch = 0;
-
if (ieee->proto_started)
return;
-
+
ieee->proto_started = 1;
-
+
if (ieee->current_network.channel == 0){
do{
ch++;
- if (ch > MAX_CHANNEL_NUMBER)
+ if (ch > MAX_CHANNEL_NUMBER)
return; /* no channel found */
-
+
}while(!ieee->channel_map[ch]);
-
+
ieee->current_network.channel = ch;
}
-
+
if (ieee->current_network.beacon_interval == 0)
ieee->current_network.beacon_interval = 100;
-
ieee->set_chan(ieee->dev,ieee->current_network.channel);
-
ieee->last_seq_num = -1;
ieee->last_frag_num = -1;
ieee->last_packet_time = 0;
@@ -2107,30 +2149,27 @@
* attempts does not fail just because the user provide the essid
* and the nic is still checking for the AP MAC ??
*/
-
+
if (ieee->iw_mode == IW_MODE_INFRA)
- ieee80211_start_bss(ieee);
-
+ ieee80211_start_bss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_ADHOC)
- ieee80211_start_ibss(ieee);
-
+ ieee80211_start_ibss_rtl7(ieee);
else if (ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_master_bss(ieee);
-
+ ieee80211_start_master_bss_rtl7(ieee);
else if(ieee->iw_mode == IW_MODE_MONITOR)
- ieee80211_start_monitor_mode(ieee);
+ ieee80211_start_monitor_mode_rtl7(ieee);
}
#define DRV_NAME "Ieee80211"
-void ieee80211_softmac_init(struct ieee80211_device *ieee)
+void ieee80211_softmac_init_rtl7(struct ieee80211_device *ieee)
{
memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-
+
ieee->state = IEEE80211_NOLINK;
ieee->sync_scan_hurryup = 0;
ieee->seq_ctrl = 0;
-
+
ieee->assoc_id = 0;
ieee->queue_stop = 0;
ieee->scanning = 0;
@@ -2142,66 +2181,75 @@
ieee->rate = 3;
ieee->ps = IEEE80211_PS_DISABLED;
ieee->sta_sleep = 0;
-
- init_mgmt_queue(ieee);
+
+ init_mgmt_queue_rtl7(ieee);
#if 0
init_timer(&ieee->scan_timer);
ieee->scan_timer.data = (unsigned long)ieee;
ieee->scan_timer.function = ieee80211_softmac_scan_cb;
#endif
ieee->tx_pending.txb = NULL;
-
+
init_timer(&ieee->associate_timer);
ieee->associate_timer.data = (unsigned long)ieee;
- ieee->associate_timer.function = ieee80211_associate_abort_cb;
+ ieee->associate_timer.function = ieee80211_associate_abort_cb_rtl7;
init_timer(&ieee->beacon_timer);
ieee->beacon_timer.data = (unsigned long) ieee;
- ieee->beacon_timer.function = ieee80211_send_beacon_cb;
-
+ ieee->beacon_timer.function = ieee80211_send_beacon_cb_rtl7;
+
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
-#else
+#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
-
- INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
- INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee);
- INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee);
- INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee);
- INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee);
- INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee);
-
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq_rtl7,ieee);
+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq_rtl7,ieee);
+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq_rtl7,ieee);
+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq_rtl7,ieee);
+#else
+ INIT_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq_rtl7);
+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq_rtl7);
+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq_rtl7);
+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq_rtl7);
+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq_rtl7);
+#endif
+
sema_init(&ieee->wx_sem, 1);
sema_init(&ieee->scan_sem, 1);
-
+
spin_lock_init(&ieee->mgmt_tx_lock);
spin_lock_init(&ieee->beacon_lock);
-
+
tasklet_init(&ieee->ps_task,
- (void(*)(unsigned long)) ieee80211_sta_ps,
+ (void(*)(unsigned long)) ieee80211_sta_ps_rtl7,
(unsigned long)ieee);
}
-void ieee80211_softmac_free(struct ieee80211_device *ieee)
+void ieee80211_softmac_free_rtl7(struct ieee80211_device *ieee)
{
down(&ieee->wx_sem);
-
+
del_timer_sync(&ieee->associate_timer);
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
-
+
up(&ieee->wx_sem);
}
-/********************************************************
+/********************************************************
* Start of WPA code. *
* this is stolen from the ipw2200 driver *
********************************************************/
-
-static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
+
+static int ieee80211_wpa_enable_rtl7(struct ieee80211_device *ieee, int value)
{
/* This is called when wpa_supplicant loads and closes the driver
* interface. */
@@ -2210,19 +2258,19 @@
return 0;
}
-
-void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
+
+void ieee80211_wpa_assoc_frame_rtl7(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
{
/* make sure WPA is enabled */
- ieee80211_wpa_enable(ieee, 1);
+ ieee80211_wpa_enable_rtl7(ieee, 1);
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
}
-static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
+static int ieee80211_wpa_mlme_rtl7(struct ieee80211_device *ieee, int command, int reason)
{
-
+
int ret = 0;
switch (command) {
@@ -2231,7 +2279,7 @@
break;
case IEEE_MLME_STA_DISASSOC:
- ieee80211_disassociate(ieee);
+ ieee80211_disassociate_rtl7(ieee);
break;
default:
@@ -2243,7 +2291,7 @@
}
-static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_wpa_ie_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int plen)
{
u8 *buf;
@@ -2267,16 +2315,16 @@
ieee->wpa_ie_len = 0;
}
- ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
+ ieee80211_wpa_assoc_frame_rtl7(ieee, ieee->wpa_ie, ieee->wpa_ie_len);
return 0;
}
#define AUTH_ALG_OPEN_SYSTEM 0x1
#define AUTH_ALG_SHARED_KEY 0x2
-static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
+static int ieee80211_wpa_set_auth_algs_rtl7(struct ieee80211_device *ieee, int value)
{
-
+
struct ieee80211_security sec = {
.flags = SEC_AUTH_MODE,
};
@@ -2300,13 +2348,13 @@
-static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value)
+static int ieee80211_wpa_set_param_rtl7(struct ieee80211_device *ieee, u8 name, u32 value)
{
int ret=0;
switch (name) {
case IEEE_PARAM_WPA_ENABLED:
- ret = ieee80211_wpa_enable(ieee, value);
+ ret = ieee80211_wpa_enable_rtl7(ieee, value);
break;
case IEEE_PARAM_TKIP_COUNTERMEASURES:
@@ -2351,7 +2399,7 @@
break;
case IEEE_PARAM_AUTH_ALGS:
- ret = ieee80211_wpa_set_auth_algs(ieee, value);
+ ret = ieee80211_wpa_set_auth_algs_rtl7(ieee, value);
break;
case IEEE_PARAM_IEEE_802_1X:
@@ -2368,11 +2416,11 @@
/* implementation borrowed from hostap driver */
-static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
+static int ieee80211_wpa_set_encryption_rtl7(struct ieee80211_device *ieee,
struct ieee_param *param, int param_len)
{
int ret = 0;
-
+
struct ieee80211_crypto_ops *ops;
struct ieee80211_crypt_data **crypt;
@@ -2407,7 +2455,7 @@
//sec.encrypt = 0;
sec.level = SEC_LEVEL_0;
sec.flags |= SEC_ENABLED | SEC_LEVEL;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
goto done;
}
@@ -2421,16 +2469,16 @@
strcmp(param->u.crypt.alg, "TKIP"))
goto skip_host_crypt;
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
- request_module("ieee80211_crypt_wep");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_wep_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
- request_module("ieee80211_crypt_tkip");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_tkip_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
} else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
- request_module("ieee80211_crypt_ccmp");
- ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
+ request_module("ieee80211_crypt_ccmp_rtl");
+ ops = ieee80211_get_crypto_ops_rtl7(param->u.crypt.alg);
}
if (ops == NULL) {
printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
@@ -2442,7 +2490,7 @@
if (*crypt == NULL || (*crypt)->ops != ops) {
struct ieee80211_crypt_data *new_crypt;
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
new_crypt = (struct ieee80211_crypt_data *)
kmalloc(sizeof(*new_crypt), GFP_KERNEL);
@@ -2525,7 +2573,7 @@
-int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p)
+int ieee80211_wpa_supplicant_ioctl_rtl7(struct ieee80211_device *ieee, struct iw_point *p)
{
struct ieee_param *param;
int ret=0;
@@ -2537,7 +2585,7 @@
ret = -EINVAL;
goto out;
}
-
+
param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
if (param == NULL){
ret = -ENOMEM;
@@ -2552,20 +2600,20 @@
switch (param->cmd) {
case IEEE_CMD_SET_WPA_PARAM:
- ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name,
+ ret = ieee80211_wpa_set_param_rtl7(ieee, param->u.wpa_param.name,
param->u.wpa_param.value);
break;
case IEEE_CMD_SET_WPA_IE:
- ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length);
+ ret = ieee80211_wpa_set_wpa_ie_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_SET_ENCRYPTION:
- ret = ieee80211_wpa_set_encryption(ieee, param, p->length);
+ ret = ieee80211_wpa_set_encryption_rtl7(ieee, param, p->length);
break;
case IEEE_CMD_MLME:
- ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command,
+ ret = ieee80211_wpa_mlme_rtl7(ieee, param->u.mlme.command,
param->u.mlme.reason_code);
break;
@@ -2581,11 +2629,11 @@
kfree(param);
out:
up(&ieee->wx_sem);
-
+
return ret;
}
-void notify_wx_assoc_event(struct ieee80211_device *ieee)
+void notify_wx_assoc_event_rtl7(struct ieee80211_device *ieee)
{
union iwreq_data wrqu;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -2597,14 +2645,14 @@
}
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
+EXPORT_SYMBOL(ieee80211_get_beacon_rtl7);
+EXPORT_SYMBOL(ieee80211_wake_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_stop_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_reset_queue_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_softmac_start_protocol_rtl7);
+EXPORT_SYMBOL(ieee80211_is_shortslot_rtl7);
+EXPORT_SYMBOL(ieee80211_is_54g_rtl7);
+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl_rtl7);
+EXPORT_SYMBOL(ieee80211_ps_tx_ack_rtl7);
+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_softmac_wx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.c 2008-01-30 17:38:11.000000000 +0100
@@ -1,7 +1,7 @@
/* IEEE 802.11 SoftMAC layer
* Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
*
- * Mostly extracted from the rtl8180-sa2400 driver for the
+ * Mostly extracted from the rtl8180-sa2400 driver for the
* in-kernel generic ieee802.11 stack.
*
* Some pieces of code might be stolen from ipw2100 driver
@@ -18,23 +18,23 @@
/* FIXME: add A freqs */
-const long ieee80211_wlan_frequencies[] = {
- 2412, 2417, 2422, 2427,
- 2432, 2437, 2442, 2447,
- 2452, 2457, 2462, 2467,
- 2472, 2484
+const long ieee80211_wlan_frequencies_rtl7[] = {
+ 2412, 2417, 2422, 2427,
+ 2432, 2437, 2442, 2447,
+ 2452, 2457, 2462, 2467,
+ 2472, 2484
};
-int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_freq_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret;
struct iw_freq *fwrq = & wrqu->freq;
down(&ieee->wx_sem);
-
- if(ieee->iw_mode == IW_MODE_INFRA){
+
+ if(ieee->iw_mode == IW_MODE_INFRA){
ret = -EOPNOTSUPP;
goto out;
}
@@ -45,31 +45,31 @@
fwrq->m <= (int) 2.487e8)) {
int f = fwrq->m / 100000;
int c = 0;
-
- while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
+
+ while ((c < 14) && (f != ieee80211_wlan_frequencies_rtl7[c]))
c++;
-
+
/* hack to fall through */
fwrq->e = 0;
fwrq->m = c + 1;
}
}
-
- if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
+
+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
ret = -EOPNOTSUPP;
goto out;
-
+
}else { /* Set the channel */
-
-
+
+
ieee->current_network.channel = fwrq->m;
ieee->set_chan(ieee->dev, ieee->current_network.channel);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
if(ieee->state == IEEE80211_LINKED){
-
- ieee80211_stop_send_beacons(ieee);
- ieee80211_start_send_beacons(ieee);
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+ ieee80211_start_send_beacons_rtl7(ieee);
}
}
@@ -80,7 +80,7 @@
}
-int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
+int ieee80211_wx_get_freq_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -88,110 +88,110 @@
if (ieee->current_network.channel == 0)
return -1;
-
+
fwrq->m = ieee->current_network.channel;
fwrq->e = 0;
-
+
return 0;
}
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_wap_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long flags;
-
+ unsigned long flags;
+
wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
/* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->wap_set == 0)
-
+
memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
else
- memcpy(wrqu->ap_addr.sa_data,
+ memcpy(wrqu->ap_addr.sa_data,
ieee->current_network.bssid, ETH_ALEN);
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return 0;
}
-int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
+int ieee80211_wx_set_wap_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *awrq,
char *extra)
{
-
+
int ret = 0;
u8 zero[] = {0,0,0,0,0,0};
unsigned long flags;
-
+
+ struct sockaddr *temp = NULL;
short ifup = ieee->proto_started;//dev->flags & IFF_UP;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
- struct sockaddr *temp = (struct sockaddr *)awrq;
-
+
+ temp = (struct sockaddr *)awrq;
/* use ifconfig hw ether */
if (ieee->iw_mode == IW_MODE_MASTER){
ret = -1;
goto out;
}
-
+
if (temp->sa_family != ARPHRD_ETHER){
ret = -EINVAL;
goto out;
}
-
+
if (ifup)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* just to avoid to give inconsistent infos in the
- * get wx method. not really needed otherwise
+ * get wx method. not really needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
- memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
+
+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (ifup)
- ieee80211_start_protocol(ieee);
-
+ ieee80211_start_protocol_rtl7(ieee);
+
out:
up(&ieee->wx_sem);
return ret;
}
-
- int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
+
+ int ieee80211_wx_get_essid_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
{
int len,ret = 0;
unsigned long flags;
-
+
if (ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
- /* We want avoid to give to the user inconsistent infos*/
+
+ /* We want avoid to give to the user inconsistent infos*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (ieee->current_network.ssid[0] == '\0' ||
- ieee->current_network.ssid_len == 0){
+ ieee->current_network.ssid_len == 0){
ret = -1;
goto out;
}
-
- if (ieee->state != IEEE80211_LINKED &&
+
+ if (ieee->state != IEEE80211_LINKED &&
ieee->state != IEEE80211_LINKED_SCANNING &&
ieee->ssid_set == 0){
ret = -1;
@@ -204,59 +204,76 @@
out:
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
return ret;
-
+
}
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
+int ieee80211_wx_set_rate_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
u32 target_rate = wrqu->bitrate.value;
-
+
ieee->rate = target_rate/100000;
//FIXME: we might want to limit rate also in management protocols.
- return 0;
+ return 0;
}
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+int ieee80211_wx_get_rate_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
wrqu->bitrate.value = ieee->rate * 100000;
-
+
return 0;
}
-int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
-
+ short prev = ieee->raw_tx;
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->mode == ieee->iw_mode)
goto out;
-
+
if (wrqu->mode == IW_MODE_MONITOR){
-
- ieee->dev->type = ARPHRD_IEEE80211;
+ ieee->dev->type = ARPHRD_IEEE80211_PRISM;
}else{
ieee->dev->type = ARPHRD_ETHER;
}
-
+
if (!ieee->proto_started){
ieee->iw_mode = wrqu->mode;
}else{
- ieee80211_stop_protocol(ieee);
+ ieee80211_stop_protocol_rtl7(ieee);
ieee->iw_mode = wrqu->mode;
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ ieee->raw_tx = 1;
+ if(prev == 0 && ieee->raw_tx){
+ if (ieee->data_hard_resume)
+ ieee->data_hard_resume(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
+ }
+
+ netif_carrier_on(ieee->dev);
+ }
+ else
+ {
+ ieee->raw_tx = 0;
}
out:
@@ -264,120 +281,132 @@
return 0;
}
-void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
+void ieee80211_wx_sync_scan_wq_rtl7(struct work_struct *work)
{
+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+#else
+void ieee80211_wx_sync_scan_wq_rtl7(struct ieee80211_device *ieee)
+{
+#endif
short chan;
chan = ieee->current_network.channel;
-
+
netif_carrier_off(ieee->dev);
-
+
if (ieee->data_hard_stop)
ieee->data_hard_stop(ieee->dev);
-
- ieee80211_stop_send_beacons(ieee);
-
+
+ ieee80211_stop_send_beacons_rtl7(ieee);
+
ieee->state = IEEE80211_LINKED_SCANNING;
ieee->link_change(ieee->dev);
-
- ieee80211_start_scan_syncro(ieee);
-
+
+ ieee80211_start_scan_syncro_rtl7(ieee);
+
ieee->set_chan(ieee->dev, chan);
-
+
ieee->state = IEEE80211_LINKED;
ieee->link_change(ieee->dev);
-
+
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
+
if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
- ieee80211_start_send_beacons(ieee);
-
+ ieee80211_start_send_beacons_rtl7(ieee);
+
netif_carrier_on(ieee->dev);
-
+
up(&ieee->wx_sem);
-
+
}
-int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
+int ieee80211_wx_set_scan_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
int ret = 0;
-
+
down(&ieee->wx_sem);
-
- if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
+
+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
ret = -1;
goto out;
}
-
+
if ( ieee->state == IEEE80211_LINKED){
queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
/* intentionally forget to up sem */
return 0;
}
-
+
out:
up(&ieee->wx_sem);
return ret;
}
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
+int ieee80211_wx_set_essid_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *a,
union iwreq_data *wrqu, char *extra)
{
-
+
int ret=0,len;
short proto_started;
unsigned long flags;
-
+
ieee->sync_scan_hurryup = 1;
-
+
down(&ieee->wx_sem);
-
+
proto_started = ieee->proto_started;
-
+
if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
goto out;
}
-
+
if (ieee->iw_mode == IW_MODE_MONITOR){
ret= -1;
goto out;
}
-
+
if(proto_started)
- ieee80211_stop_protocol(ieee);
-
+ ieee80211_stop_protocol_rtl7(ieee);
+
/* this is just to be sure that the GET wx callback
* has consisten infos. not needed otherwise
*/
spin_lock_irqsave(&ieee->lock, flags);
-
+
if (wrqu->essid.flags && wrqu->essid.length) {
+#if WIRELESS_EXT > 20
+ len = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
+#else
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-
+#endif
+
strncpy(ieee->current_network.ssid, extra, len);
ieee->current_network.ssid_len = len;
ieee->ssid_set = 1;
}
- else{
+ else{
ieee->ssid_set = 0;
ieee->current_network.ssid[0] = '\0';
ieee->current_network.ssid_len = 0;
}
-
+
spin_unlock_irqrestore(&ieee->lock, flags);
-
+
if (proto_started)
- ieee80211_start_protocol(ieee);
+ ieee80211_start_protocol_rtl7(ieee);
out:
up(&ieee->wx_sem);
+
+
return ret;
}
- int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
+ int ieee80211_wx_get_mode_rtl7(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b)
{
@@ -385,23 +414,23 @@
return 0;
}
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+ int ieee80211_wx_set_rawtx_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
-
+
int *parms = (int *)extra;
int enable = (parms[0] > 0);
short prev = ieee->raw_tx;
down(&ieee->wx_sem);
-
- if(enable)
+
+ if(enable)
ieee->raw_tx = 1;
- else
+ else
ieee->raw_tx = 0;
- printk(KERN_INFO"raw TX is %s\n",
+ printk(KERN_INFO"raw TX is %s\n",
ieee->raw_tx ? "enabled" : "disabled");
if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -409,21 +438,21 @@
if(prev == 0 && ieee->raw_tx){
if (ieee->data_hard_resume)
ieee->data_hard_resume(ieee->dev);
-
- netif_carrier_on(ieee->dev);
+
+ netif_carrier_on(ieee->dev);
}
-
+
if(prev && ieee->raw_tx == 1)
- netif_carrier_off(ieee->dev);
+ netif_carrier_off(ieee->dev);
}
-
+
up(&ieee->wx_sem);
-
+
return 0;
}
-
-int ieee80211_wx_get_name(struct ieee80211_device *ieee,
- struct iw_request_info *info,
+
+int ieee80211_wx_get_name_rtl7(struct ieee80211_device *ieee,
+ struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
strcpy(wrqu->name, "802.11");
@@ -433,20 +462,20 @@
strcat(wrqu->name, "/g");
}else if(ieee->modulation & IEEE80211_OFDM_MODULATION)
strcat(wrqu->name, "g");
-
- if((ieee->state == IEEE80211_LINKED) ||
+
+ if((ieee->state == IEEE80211_LINKED) ||
(ieee->state == IEEE80211_LINKED_SCANNING))
strcat(wrqu->name," linked");
else if(ieee->state != IEEE80211_NOLINK)
strcat(wrqu->name," link..");
-
-
+
+
return 0;
}
/* this is mostly stolen from hostap */
-int ieee80211_wx_set_power(struct ieee80211_device *ieee,
+int ieee80211_wx_set_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -457,50 +486,50 @@
(!ieee->ps_request_tx_ack) ||
(!ieee->enter_sleep_state) ||
(!ieee->ps_is_queue_empty)){
-
+
printk("ERROR. PS mode is tryied to be use but\
-driver missed a callback\n\n");
-
+driver missed a callback\n\n");
+
return -1;
}
-
+
down(&ieee->wx_sem);
-
+
if (wrqu->power.disabled){
ieee->ps = IEEE80211_PS_DISABLED;
-
+
goto exit;
}
switch (wrqu->power.flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
ieee->ps = IEEE80211_PS_UNICAST;
-
+
break;
case IW_POWER_ALL_R:
- ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
break;
-
+
case IW_POWER_ON:
ieee->ps = IEEE80211_PS_DISABLED;
break;
-
+
default:
ret = -EINVAL;
goto exit;
}
if (wrqu->power.flags & IW_POWER_TIMEOUT) {
-
+
ieee->ps_timeout = wrqu->power.value / 1000;
printk("Timeout %d\n",ieee->ps_timeout);
}
-
+
if (wrqu->power.flags & IW_POWER_PERIOD) {
-
+
ret = -EOPNOTSUPP;
goto exit;
//wrq->value / 1024;
-
+
}
exit:
up(&ieee->wx_sem);
@@ -509,15 +538,15 @@
}
/* this is stolen from hostap */
-int ieee80211_wx_get_power(struct ieee80211_device *ieee,
+int ieee80211_wx_get_power_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
int ret =0;
-
+
down(&ieee->wx_sem);
-
- if(ieee->ps == IEEE80211_PS_DISABLED){
+
+ if(ieee->ps == IEEE80211_PS_DISABLED){
wrqu->power.disabled = 1;
goto exit;
}
@@ -547,19 +576,19 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
+EXPORT_SYMBOL(ieee80211_wx_get_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_essid_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_rate_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_wap_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_mode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_freq_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_rawtx_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_name_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_power_rtl7);
+EXPORT_SYMBOL(ieee80211_wlan_frequencies_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_tx.c 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.c 2008-01-30 17:38:11.000000000 +0100
@@ -24,15 +24,14 @@
******************************************************************************
- Few modifications for Realtek's Wi-Fi drivers by
+ Few modifications for Realtek's Wi-Fi drivers by
Andrea Merello <andreamrl@tiscali.it>
-
- A special thanks goes to Realtek for their support !
+
+ A special thanks goes to Realtek for their support !
******************************************************************************/
#include <linux/compiler.h>
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
@@ -52,6 +51,12 @@
#include <linux/etherdevice.h>
#include <asm/uaccess.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+#include <linux/config.h>
+#else
+#include <linux/autoconf.h>
+#endif
+
#include "ieee80211.h"
@@ -155,7 +160,7 @@
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
-static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
+static inline int ieee80211_put_snap_rtl7(u8 *data, u16 h_proto)
{
struct ieee80211_snap_hdr *snap;
u8 *oui;
@@ -178,7 +183,7 @@
return SNAP_SIZE + sizeof(u16);
}
-int ieee80211_encrypt_fragment(
+int ieee80211_encrypt_fragment_rtl7(
struct ieee80211_device *ieee,
struct sk_buff *frag,
int hdr_len)
@@ -225,7 +230,7 @@
}
-void ieee80211_txb_free(struct ieee80211_txb *txb) {
+void ieee80211_txb_free_rtl7(struct ieee80211_txb *txb) {
int i;
if (unlikely(!txb))
return;
@@ -235,7 +240,7 @@
kfree(txb);
}
-struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
+struct ieee80211_txb *ieee80211_alloc_txb_rtl7(int nr_frags, int txb_size,
int gfp_mask)
{
struct ieee80211_txb *txb;
@@ -267,7 +272,7 @@
}
/* SKBs are added to the ieee->tx_queue. */
-int ieee80211_xmit(struct sk_buff *skb,
+int ieee80211_xmit_rtl7(struct sk_buff *skb,
struct net_device *dev)
{
struct ieee80211_device *ieee = netdev_priv(dev);
@@ -299,27 +304,27 @@
}
if(likely(ieee->raw_tx == 0)){
-
+
if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
-
+
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-
+
crypt = ieee->crypt[ieee->tx_keyidx];
-
+
encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
ieee->host_encrypt && crypt && crypt->ops;
-
+
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
stats->tx_dropped++;
goto success;
}
-
+
#ifdef CONFIG_IEEE80211_DEBUG
if (crypt && !encrypt && ether_type == ETH_P_PAE) {
struct eapol *eap = (struct eapol *)(skb->data +
@@ -328,23 +333,23 @@
eap_get_type(eap->type));
}
#endif
-
+
/* Save source and destination addresses */
memcpy(&dest, skb->data, ETH_ALEN);
memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
-
+
/* Advance the SKB to the start of the payload */
skb_pull(skb, sizeof(struct ethhdr));
-
+
/* Determine total amount of storage required for TXB packets */
bytes = skb->len + SNAP_SIZE + sizeof(u16);
-
+
if (encrypt)
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_WEP;
else
fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
-
+
if (ieee->iw_mode == IW_MODE_INFRA) {
fc |= IEEE80211_FCTL_TODS;
/* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -360,9 +365,9 @@
memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
}
header.frame_ctl = cpu_to_le16(fc);
-
+
hdr_len = IEEE80211_3ADDR_LEN;
-
+
/* Determine fragmentation size based on destination (multicast
* and broadcast are not fragmented) */
if (is_multicast_ether_addr(dest) ||
@@ -370,7 +375,7 @@
frag_size = MAX_FRAG_THRESHOLD;
else
frag_size = ieee->fts;
-
+
/* Determine amount of payload per fragment. Regardless of if
* this stack is providing the full 802.11 header, one will
* eventually be affixed to this fragment -- so we must account for
@@ -379,12 +384,12 @@
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
bytes_per_frag -= IEEE80211_FCS_LEN;
-
+
/* Each fragment may need to have room for encryptiong pre/postfix */
if (encrypt)
bytes_per_frag -= crypt->ops->extra_prefix_len +
crypt->ops->extra_postfix_len;
-
+
/* Number of fragments is the total bytes_per_frag /
* payload_per_fragment */
nr_frags = bytes / bytes_per_frag;
@@ -393,11 +398,11 @@
nr_frags++;
else
bytes_last_frag = bytes_per_frag;
-
+
/* When we allocate the TXB we allocate enough space for the reserve
* and full fragment bytes (bytes_per_frag doesn't include prefix,
* postfix, header, FCS, etc.) */
- txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC);
+ txb = ieee80211_alloc_txb_rtl7(nr_frags, frag_size, GFP_ATOMIC);
if (unlikely(!txb)) {
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
@@ -405,93 +410,94 @@
}
txb->encrypted = encrypt;
txb->payload_size = bytes;
-
+
for (i = 0; i < nr_frags; i++) {
skb_frag = txb->fragments[i];
-
+
if (encrypt)
skb_reserve(skb_frag, crypt->ops->extra_prefix_len);
-
+
frag_hdr = (struct ieee80211_hdr *)skb_put(skb_frag, hdr_len);
memcpy(frag_hdr, &header, hdr_len);
-
+
/* If this is not the last fragment, then add the MOREFRAGS
* bit to the frame control */
if (i != nr_frags - 1) {
frag_hdr->frame_ctl = cpu_to_le16(
fc | IEEE80211_FCTL_MOREFRAGS);
bytes = bytes_per_frag;
-
+
} else {
/* The last fragment takes the remaining length */
bytes = bytes_last_frag;
}
-
+
frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i);
-
-
+
+
/* Put a SNAP header on the first fragment */
if (i == 0) {
- ieee80211_put_snap(
+ ieee80211_put_snap_rtl7(
skb_put(skb_frag, SNAP_SIZE + sizeof(u16)),
ether_type);
bytes -= SNAP_SIZE + sizeof(u16);
}
-
+
memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
-
+
/* Advance the SKB... */
skb_pull(skb, bytes);
-
+
/* Encryption routine will move the header forward in order
* to insert the IV between the header and the payload */
if (encrypt)
- ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ ieee80211_encrypt_fragment_rtl7(ieee, skb_frag, hdr_len);
if (ieee->config &
(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
skb_put(skb_frag, 4);
}
- // Advance sequence number in data frame.
+ // Advance sequence number in data frame.
if (ieee->seq_ctrl == 0xFFF)
ieee->seq_ctrl = 0;
else
ieee->seq_ctrl++;
//---
}else{
- if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+// if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) {
+ if (unlikely(skb->len < 14)) {
printk(KERN_WARNING "%s: skb too small (%d).\n",
ieee->dev->name, skb->len);
goto success;
}
-
- txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
+
+ txb = ieee80211_alloc_txb_rtl7(1, skb->len, GFP_ATOMIC);
if(!txb){
printk(KERN_WARNING "%s: Could not allocate TXB\n",
ieee->dev->name);
goto failed;
}
-
+
txb->encrypted = 0;
txb->payload_size = skb->len;
memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
- }
+ }
success:
spin_unlock_irqrestore(&ieee->lock, flags);
dev_kfree_skb_any(skb);
if (txb) {
if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){
- ieee80211_softmac_xmit(txb, ieee);
+ ieee80211_softmac_xmit_rtl7(txb, ieee);
}else{
if ((*ieee->hard_start_xmit)(txb, dev) == 0) {
stats->tx_packets++;
stats->tx_bytes += txb->payload_size;
return 0;
}
- ieee80211_txb_free(txb);
+ ieee80211_txb_free_rtl7(txb);
}
-
-
+
+
}
return 0;
@@ -504,4 +510,4 @@
}
-EXPORT_SYMBOL(ieee80211_txb_free);
+EXPORT_SYMBOL(ieee80211_txb_free_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c
--- rtl8187_linux_26.1010.0622.2006/ieee80211/ieee80211_wx.c 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.c 2008-01-30 17:38:11.000000000 +0100
@@ -40,7 +40,7 @@
};
#define MAX_CUSTOM_LEN 64
-static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee,
+static inline char *ipw2100_translate_scan_rtl7(struct ieee80211_device *ieee,
char *start, char *stop,
struct ieee80211_network *network)
{
@@ -207,7 +207,7 @@
return start;
}
-int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
+int ieee80211_wx_get_scan_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
@@ -220,13 +220,14 @@
IEEE80211_DEBUG_WX("Getting scan\n");
down(&ieee->wx_sem);
+ printk("GOT WX GET SCAN WX_SEM LOCK");
spin_lock_irqsave(&ieee->lock, flags);
list_for_each_entry(network, &ieee->network_list, list) {
i++;
if (ieee->scan_age == 0 ||
time_after(network->last_scanned + ieee->scan_age, jiffies))
- ev = ipw2100_translate_scan(ieee, ev, stop, network);
+ ev = ipw2100_translate_scan_rtl7(ieee, ev, stop, network);
else
IEEE80211_DEBUG_SCAN(
"Not showing network '%s ("
@@ -247,7 +248,7 @@
return 0;
}
-int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_set_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -259,6 +260,9 @@
int i, key, key_provided, len;
struct ieee80211_crypt_data **crypt;
+ if (erq->flags & IW_ENCODE_RESTRICTED)
+ return -EINVAL;
+
IEEE80211_DEBUG_WX("SET_ENCODE\n");
key = erq->flags & IW_ENCODE_INDEX;
@@ -281,7 +285,7 @@
if (key_provided && *crypt) {
IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n",
key);
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
} else
IEEE80211_DEBUG_WX("Disabling encryption.\n");
@@ -291,7 +295,7 @@
if (ieee->crypt[i] != NULL) {
if (key_provided)
break;
- ieee80211_crypt_delayed_deinit(
+ ieee80211_crypt_delayed_deinit_rtl7(
ieee, &ieee->crypt[i]);
}
}
@@ -314,7 +318,7 @@
strcmp((*crypt)->ops->name, "WEP") != 0) {
/* changing to use WEP; deinit previously used algorithm
* on this key */
- ieee80211_crypt_delayed_deinit(ieee, crypt);
+ ieee80211_crypt_delayed_deinit_rtl7(ieee, crypt);
}
if (*crypt == NULL) {
@@ -326,10 +330,10 @@
if (new_crypt == NULL)
return -ENOMEM;
memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
if (!new_crypt->ops) {
- request_module("ieee80211_crypt_wep");
- new_crypt->ops = ieee80211_get_crypto_ops("WEP");
+ request_module("ieee80211_crypt_wep_rtl");
+ new_crypt->ops = ieee80211_get_crypto_ops_rtl7("WEP");
}
if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
@@ -340,7 +344,7 @@
new_crypt = NULL;
printk(KERN_WARNING "%s: could not initialize WEP: "
- "load module ieee80211_crypt_wep\n",
+ "load module ieee80211_crypt_wep_rtl\n",
dev->name);
return -EOPNOTSUPP;
}
@@ -418,7 +422,7 @@
return 0;
}
-int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
+int ieee80211_wx_get_encode_rtl7(struct ieee80211_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *keybuf)
{
@@ -430,7 +434,7 @@
if(ieee->iw_mode == IW_MODE_MONITOR)
return -1;
-
+
key = erq->flags & IW_ENCODE_INDEX;
if (key) {
if (key > WEP_KEYS)
@@ -470,6 +474,6 @@
}
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
+EXPORT_SYMBOL(ieee80211_wx_get_scan_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_set_encode_rtl7);
+EXPORT_SYMBOL(ieee80211_wx_get_encode_rtl7);
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Makefile 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Makefile 2008-01-30 17:38:11.000000000 +0100
@@ -17,6 +17,7 @@
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
INSTALL_PREFIX :=
+PWD = $(shell pwd)
all: modules
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers
--- rtl8187_linux_26.1010.0622.2006/ieee80211/Modules.symvers 2006-06-06 04:57:56.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/Modules.symvers 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-0x232e7944 ieee80211_wlan_frequencies /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xaeae102f free_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x279e265f ieee80211_crypt_deinit_handler net/ieee80211/ieee80211_crypt
-0xc2411d91 ieee80211_stop_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6ece20e1 ieee80211_wx_get_name_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0x5d3847ff ieee80211_rx_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x18612027 ieee80211_wx_get_scan_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xa0e03ce1 ieee80211_wx_get_name /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xee25f349 ieee80211_wx_get_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x86013c3d ieee80211_wx_set_mode /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x04493cc0 ieee80211_wx_get_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6c6df3b4 ieee80211_wx_set_rate /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x82caec02 ieee80211_crypt_deinit_entries net/ieee80211/ieee80211_crypt
-0x347945bf ieee80211_wx_get_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6379d455 ieee80211_wx_set_power /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xae62ed59 ieee80211_wx_set_scan /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6621e172 ieee80211_wx_set_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x0e052e06 ieee80211_wx_get_freq /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x283f9f5d ieee80211_unregister_crypto_ops net/ieee80211/ieee80211_crypt
-0x9da79aac ieee80211_is_shortslot /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x666032dc ieee80211_wx_get_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9f1cbe0e ieee80211_wx_set_wap /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x73d1d341 ieee80211_wx_set_rawtx /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2c714184 ieee80211_is_54g /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x6892d598 ieee80211_wpa_supplicant_ioctl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc062f1f5 ieee80211_ps_tx_ack /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x55534906 ieee80211_get_beacon /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xe2679638 ieee80211_crypt_delayed_deinit net/ieee80211/ieee80211_crypt
-0x3a0456bc free_ieee80211 net/ieee80211/ieee80211
-0x7e1ef2c8 ieee80211_wake_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xc1b81e9f ieee80211_register_crypto_ops net/ieee80211/ieee80211_crypt
-0x3f795a39 alloc_ieee80211 net/ieee80211/ieee80211
-0x89803c23 ieee80211_get_crypto_ops net/ieee80211/ieee80211_crypt
-0xc6caf2a4 ieee80211_txb_free net/ieee80211/ieee80211
-0x49c1422c ieee80211_rx_mgt net/ieee80211/ieee80211
-0xbf2b4ebd alloc_ieee80211_rtl /usr/rtl8187_linux_2.6_05312006/ieee80211/ieee80211-rtl
-0xd155f7b8 ieee80211_softmac_stop_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x9ce2dcde ieee80211_softmac_start_protocol /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x00d74bba ieee80211_wx_get_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x92b5d996 ieee80211_wx_set_encode_rtl /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x2ac9bf95 ieee80211_wx_set_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0x7dc92e7f ieee80211_wx_get_essid /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
-0xd04740ca ieee80211_reset_queue /home/woo/rtl8187_linuxdrv_FC2_V1.1_Src/ieee80211/ieee80211-rtl
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_ccmp-rtl.mod 2008-02-22 15:33:07.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_ccmp.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_ccmp.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt-rtl.mod 2008-02-22 15:33:07.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_tkip-rtl.mod 2008-02-22 15:33:07.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_tkip.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_tkip.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211_crypt_wep-rtl.mod 2008-02-22 15:33:07.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_crypt_wep.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_crypt_wep.o
diff -Naur rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod
--- rtl8187_linux_26.1010.0622.2006/ieee80211/.tmp_versions/ieee80211-rtl.mod 2006-06-06 04:57:54.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/.tmp_versions/ieee80211-rtl.mod 2008-02-22 15:33:07.000000000 +0100
@@ -1,2 +1,2 @@
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211-rtl.ko
-/usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_rx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_tx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_wx.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_module.o /usr/rtl8187_linux_2.6_06012006/ieee80211/ieee80211_softmac_wx.o
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211-rtl.ko
+/home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_rx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_tx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_wx.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_module.o /home/pete/rtl8187_linux_26.1010.0622.2006_rawtx/ieee80211/ieee80211_softmac_wx.o
diff -Naur rtl8187_linux_26.1010.0622.2006/makedrv~ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~
--- rtl8187_linux_26.1010.0622.2006/makedrv~ 2006-09-05 07:21:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/makedrv~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-#tar -zxvf stack.tar.gz
-#tar -zxvf drv.tar.gz
-cd ieee80211
-make clean
-make
-cd ../beta-8187
-make clean
-make
-cd ..
-
-
diff -Naur rtl8187_linux_26.1010.0622.2006/Makefile rtl8187_linux_26.1010.0622.2006_rawtx/Makefile
--- rtl8187_linux_26.1010.0622.2006/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_linux_26.1010.0622.2006_rawtx/Makefile 2008-01-30 17:39:29.000000000 +0100
@@ -0,0 +1,38 @@
+prefix = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless
+r8187dir = $(prefix)/rtl8187
+ieeedir = $(prefix)/rtl_ieee80211
+
+default: all
+
+all:
+ -rm -f ieee80211/Module.symvers 2>/dev/null
+ -rm -f ieee80211/Modules.symvers 2>/dev/null
+ $(MAKE) -C ieee80211 $(@)
+ -chmod +x symvers
+ -./symvers
+ $(MAKE) -C beta-8187 $(@)
+
+install:
+ install -d $(ieeedir)
+ install -d $(r8187dir)
+ install -m 644 ./ieee80211/*.ko $(ieeedir)
+ install -m 644 ./beta-8187/*.ko $(r8187dir)
+ -depmod -ae
+
+uninstall:
+ -rm -f $(ieeedir)/ieee80211-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_ccmp-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_tkip-rtl.ko
+ -rm -f $(ieeedir)/ieee80211_crypt_wep-rtl.ko
+ -rm -f $(r8187dir)/r8187.ko
+ -rm -fr $(ieeedir)
+ -rm -fr $(r8187dir)
+ -depmod -ae
+
+clean:
+ $(MAKE) -C ieee80211 $(@)
+ $(MAKE) -C beta-8187 $(@)
+
+distclean: clean
+
diff -Naur rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~
--- rtl8187_linux_26.1010.0622.2006/ReadMe.txt~ 2006-06-06 10:58:00.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/ReadMe.txt~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,129 +0,0 @@
-Release Date: 2006-01-13, ver 1.1
-RTL8187 Linux driver version 1.1
-
- --This driver supports RealTek RTL8187 Wireless LAN driver for
- Fedora Core 2/3/4/5, Debian 3.1, Mandrake 10.2/Mandriva 2006,
- SUSE 9.3/10.1/10.2, Gentoo 3.1, etc.
- - Support Client mode for either infrastructure or adhoc mode
- - Support WEP and WPAPSK connection
-
-< Component >
-The driver is composed of several parts:
- 1. Module source code
- stack.tar.gz
- drv.tar.gz
-
- 2. Script ot build the modules
- makedrv
-
- 3. Script to load/unload modules
- wlan0up
- wlan0down
-
- 4. Script and configuration for DHCP
- wlan0dhcp
- ifcfg-wlan0
- 4. Supplicant source code:
- wpa_supplicant-0.4.9.tar.gz
-
- 5. Example of supplicant configuration file:
- wpa1.conf
-
-< Installation >
-Runing the scripts can finish all operations of building up modules
-from the source code and start the nic.
- 1. Build up the drivers from the source code
- ./makedrv
-
- 2. load the driver module to kernel and start up nic
- ./wlan0up
-
-< Set wireless lan MIBs >
-This driver uses Wireless Extension as an interface allowing you to set
-Wireless LAN specific parameters.
-
-Current driver supports "iwlist" to show the device status of nic
- iwlist wlan0 [parameters]
-where
- parameter explaination [parameters]
- ----------------------- -------------
- Show available chan and freq freq / channel
- Show and Scan BSS and IBSS scan[ning]
- Show supported bit-rate rate / bit[rate]
- Show Power Management mode power
-
-For example:
- iwlist wlan0 channel
- iwlist wlan0 scan
- iwlist wlan0 rate
- iwlist wlan0 power
-
-Driver also supports "iwconfig", manipulate driver private ioctls, to set
-MIBs.
-
- iwconfig wlan0 [parameters] [val]
-where
- parameter explaination [parameters] [val] constraints
- ----------------------- ------------- ------------------
- Connect to AP by address ap [mac_addr]
- Set the essid, join (I)BSS essid [essid]
- Set operation mode mode {Managed|Ad-hoc}
- Set keys and security mode key/enc[ryption] {N|open|restricted|off}
-
-For example:
- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
- iwconfig wlan0 essid "ap_name"
- iwconfig wlan0 mode Ad-hoc
- iwconfig wlan0 mode essid "name" mode Ad-hoc
- iwconfig wlan0 key 0123456789 [2] open
- iwconfig wlan0 key off
- iwconfig wlan0 key restricted [3] 0123456789
-
-< Getting IP address >
-After start up the nic, the network needs to obtain an IP address before
-transmit/receive data.
-This can be done by setting the static IP via "ifconfig wlan0 IP_ADDRESS"
-command, or using DHCP.
-
-If using DHCP, setting steps is as below:
- (1)connect to an AP via "iwconfig" settings
- iwconfig wlan0 essid [name] or
- iwconfig wlan0 ap XX:XX:XX:XX:XX:XX
-
- (2)run the script which run the dhclient
- ./wlan0dhcp
-
-< WPAPSK >
-WPA_SUPPLICANT help the network to communicate under the protection of WPAPSK
-mechanism
-
- (1)Unpack source code of WPA supplicant:
- tar -zxvf wpa_supplicant-0.4.9.tar.gz
- cd wpa_supplicant-0.4.9
-
- (2)Create .config file:
- cp defconfig .config
-
- (3)Edit .config file, uncomment the following line:
- #CONFIG_DRIVER_IPW=y.
-
- (4)Build WPA supplicant:
- make
-
- (5)Edit wpa_supplicant.conf to set up SSID and its passphrase.
- For example, the following setting in "wpa1.conf" means SSID
- to join is "BufAG54_Ch6" and its passphrase is "87654321".
- network={
- ssid="BufAG54_Ch6"
- proto=WPA
- key_mgmt=WPA-PSK
- pairwise=CCMP TKIP
- group=CCMP TKIP WEP104 WEP40
- psk="87654321"
- priority=2
- }
-
- (6)Execute WPA supplicant (Assume 8187 and related modules had been
- loaded):
- ./wpa_supplicant -D ipw -c wpa1.conf -i wlan0 &
-
diff -Naur rtl8187_linux_26.1010.0622.2006/symvers rtl8187_linux_26.1010.0622.2006_rawtx/symvers
--- rtl8187_linux_26.1010.0622.2006/symvers 1970-01-01 01:00:00.000000000 +0100
+++ rtl8187_linux_26.1010.0622.2006_rawtx/symvers 2008-01-30 17:38:11.000000000 +0100
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd beta-8187
+
+if [ -e Module.symvers ]
+then
+ rm Module.symvers
+fi
+
+if [ -e Modules.symvers ]
+then
+ rm Modules.symvers
+fi
+
+if [ -e ../ieee80211/Module.symvers ]
+then
+ ln -sf ../ieee80211/Module.symvers ./
+fi
+
+if [ -e ../ieee80211/Modules.symvers ]
+then
+ ln -sf ../ieee80211/Modules.symvers ./
+fi
+
+cd ..
diff -Naur rtl8187_linux_26.1010.0622.2006/wlan0rmv rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv
--- rtl8187_linux_26.1010.0622.2006/wlan0rmv 2006-09-05 07:21:10.000000000 +0200
+++ rtl8187_linux_26.1010.0622.2006_rawtx/wlan0rmv 2008-01-30 17:38:11.000000000 +0100
@@ -1,5 +1,9 @@
#!/bin/bash
-rmmod r8180
-rmmod ieee80211_r8180
-rmmod ieee80211_crypt_r8180
+rmmod rtl8187 2>/dev/null
+rmmod r8187 2>/dev/null
+rmmod ieee80211_rtl 2>/dev/null
+rmmod ieee80211_crypt_ccmp_rtl 2>/dev/null
+rmmod ieee80211_crypt_tkip_rtl 2>/dev/null
+rmmod ieee80211_crypt_wep_rtl 2>/dev/null
+rmmod ieee80211_crypt_rtl 2>/dev/null |
aircrack-ng/patches/old/sqlite-3.4.2-lib-cygwin.diff | --- Makefile 2007-10-04 22:56:07.671875000 +0200
+++ Makefile.cygwin 2007-10-04 22:54:07.468750000 +0200
@@ -681,7 +681,7 @@
mkdir -p doc
mv $(DOC) doc
-install: sqlite3$(TEXE) libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install}
+install: libsqlite3.la sqlite3.h
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
$(INSTALL) -d $(DESTDIR)$(exec_prefix)/bin |
|
aircrack-ng/patches/old/sqlite-3.5.1-lib_cygwin.diff | --- Makefile.ori 2007-10-08 22:46:20.343750000 +0200
+++ Makefile 2007-10-08 22:49:01.953125000 +0200
@@ -726,11 +726,10 @@
mkdir -p doc
mv $(DOC) doc
-install: sqlite3 libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install}
+install: libsqlite3.la sqlite3.h
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
$(INSTALL) -d $(DESTDIR)$(exec_prefix)/bin
- $(LTINSTALL) sqlite3 $(DESTDIR)$(exec_prefix)/bin
$(INSTALL) -d $(DESTDIR)$(prefix)/include
$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(prefix)/include
$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(prefix)/include |
|
aircrack-ng/patches/old/sqlite-3.5.4-lib_cygwin.diff | --- Makefile.ori 2007-12-19 00:53:49.859375000 +0100
+++ Makefile 2007-12-19 00:55:36.031250000 +0100
@@ -581,11 +581,10 @@
libtclsqlite3.la $(LIBTCL)
-install: sqlite3$(BEXE) libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install}
+install: libsqlite3.la sqlite3.h
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
$(INSTALL) -d $(DESTDIR)$(exec_prefix)/bin
- $(LTINSTALL) sqlite3$(BEXE) $(DESTDIR)$(exec_prefix)/bin
$(INSTALL) -d $(DESTDIR)$(prefix)/include
$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(prefix)/include
$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(prefix)/include |
|
aircrack-ng/patches/old/sqlite-3.5.7-lib_cygwin.diff | --- Makefile.ori 2008-03-20 22:34:53.328125000 +0100
+++ Makefile 2008-03-20 22:37:30.562500000 +0100
@@ -665,11 +665,10 @@
$(TEMP_STORE) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL)
-install: sqlite3$(BEXE) libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install}
+install: libsqlite3.la sqlite3.h
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
$(INSTALL) -d $(DESTDIR)$(bindir)
- $(LTINSTALL) sqlite3$(BEXE) $(DESTDIR)$(bindir)
$(INSTALL) -d $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir) |
|
aircrack-ng/patches/old/sqlite-3.6.11-lib_cygwin.diff | --- Makefile.ori 2009-02-19 22:17:24.015625000 +0100
+++ Makefile 2009-02-19 22:17:55.484375000 +0100
@@ -765,16 +765,12 @@
$(TEMP_STORE) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL)
-install: sqlite3$(BEXE) libsqlite3.la sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_install}
+install: libsqlite3.la sqlite3.h
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
- $(INSTALL) -d $(DESTDIR)$(bindir)
- $(LTINSTALL) sqlite3$(BEXE) $(DESTDIR)$(bindir)
$(INSTALL) -d $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir)
- $(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
- $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir)
pkgIndex.tcl:
echo 'package ifneeded sqlite3 $(RELEASE) [list load $(TCLLIBDIR)/libtclsqlite3.so sqlite3]' > $@ |
|
aircrack-ng/patches/old/sqlite-3.6.13-lib_cygwin.diff | --- Makefile.ori 2009-04-14 18:50:49.953125000 +0100
+++ Makefile 2009-04-14 18:52:45.562500000 +0100
@@ -776,14 +776,10 @@
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
-install: sqlite3$(BEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_install}
- $(INSTALL) -d $(DESTDIR)$(bindir)
- $(LTINSTALL) sqlite3$(BEXE) $(DESTDIR)$(bindir)
+install: lib_install sqlite3.h
$(INSTALL) -d $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 sqlite3.h $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 $(TOP)/src/sqlite3ext.h $(DESTDIR)$(includedir)
- $(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
- $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir)
pkgIndex.tcl:
echo 'package ifneeded sqlite3 $(RELEASE) [list load $(TCLLIBDIR)/libtclsqlite3.so sqlite3]' > $@ |
|
Patch | aircrack-ng/patches/old/wlanng-0.2.1-pre26.patch | diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/p80211/p80211netdev.c linux-wlan-ng-0.2.1-pre26/src/p80211/p80211netdev.c
--- linux-wlan-ng-0.2.1-pre26-orig/src/p80211/p80211netdev.c 2005-01-11 18:43:54.000000000 +0100
+++ linux-wlan-ng-0.2.1-pre26/src/p80211/p80211netdev.c 2005-03-14 13:58:11.000000000 +0100
@@ -525,7 +525,7 @@
* and return success .
* TODO: we need a saner way to handle this
*/
- if(skb->protocol != ETH_P_80211_RAW) {
+ if(skb->protocol != htons(ETH_P_80211_RAW)) {
p80211netdev_start_queue(wlandev);
WLAN_LOG_NOTICE(
"Tx attempt prior to association, frame dropped.\n");
@@ -537,7 +537,7 @@
}
/* Check for raw transmits */
- if(skb->protocol == ETH_P_80211_RAW) {
+ if(skb->protocol == htons(ETH_P_80211_RAW)) {
if (!capable(CAP_NET_ADMIN)) {
return(-EPERM);
}
@@ -965,8 +965,9 @@
dev->set_mac_address = p80211knetdev_set_mac_address;
#endif
#ifdef HAVE_TX_TIMEOUT
- dev->tx_timeout = &p80211knetdev_tx_timeout;
- dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000;
+// KoreK: still not implemented
+// dev->tx_timeout = &p80211knetdev_tx_timeout;
+// dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000;
#endif
}
diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/Makefile linux-wlan-ng-0.2.1-pre26/src/prism2/driver/Makefile
--- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/Makefile 2005-01-25 02:41:44.000000000 +0100
+++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/Makefile 2005-03-14 13:58:11.000000000 +0100
@@ -88,7 +88,7 @@
MODVERDIR=$(WLAN_SRC)/.tmp_versions modules
else # kbuild 2.4
- $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(PWD) WLAN_SRC=$(PWD) \
+ $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(PWD) WLAN_SRC=$(WLAN_SRC) \
modules
endif # kbuild switch
diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/hfa384x.c linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x.c
--- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/hfa384x.c 2005-01-25 01:38:50.000000000 +0100
+++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x.c 2005-03-14 15:21:02.000000000 +0100
@@ -1941,8 +1941,14 @@
DBFENTER;
- cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
- HFA384x_CMD_AINFO_SET(enable);
+ if (enable == HFA384x_MONITOR_ENABLE) {
+ // KoreK: get into test mode 0x0a
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(0x0a);
+ } else {
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(enable);
+ }
cmd.parm0 = 0;
cmd.parm1 = 0;
cmd.parm2 = 0;
@@ -3178,13 +3184,26 @@
HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0);
#endif
- /* if we're using host WEP, increase size by IV+ICV */
- if (p80211_wep->data) {
- txdesc.data_len = host2hfa384x_16(skb->len+8);
- // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
- } else {
- txdesc.data_len = host2hfa384x_16(skb->len);
- }
+ if (skb->protocol != htons(ETH_P_80211_RAW)) {
+ /* if we're using host WEP, increase size by IV+ICV */
+ if (p80211_wep->data) {
+ txdesc.data_len = host2hfa384x_16(skb->len+8);
+ // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+ } else {
+ txdesc.data_len = host2hfa384x_16(skb->len);
+ }
+ } else {
+ /* KoreK: raw injection (monitor mode): pull the rest of
+ the header and ssanity check on txdesc.data_len */
+ memcpy(&(txdesc.data_len), skb->data, 16);
+ skb_pull(skb,16);
+ if (txdesc.data_len != host2hfa384x_16(skb->len)) {
+ printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
+ return 0;
+ }
+
+ txdesc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
+ }
txdesc.tx_control = host2hfa384x_16(txdesc.tx_control);
/* copy the header over to the txdesc */
@@ -3207,7 +3226,7 @@
spin_lock(&hw->cmdlock);
/* Copy descriptor+payload to FID */
- if (p80211_wep->data) {
+ if (p80211_wep->data && (skb->protocol != htons(ETH_P_80211_RAW))) {
result = hfa384x_copy_to_bap4(hw, HFA384x_BAP_PROC, fid, 0,
&txdesc, sizeof(txdesc),
p80211_wep->iv, sizeof(p80211_wep->iv),
@@ -3657,6 +3676,16 @@
switch( HFA384x_RXSTATUS_MACPORT_GET(rxdesc.status) )
{
case 0:
+ /* KoreK: this testmode uses macport 0 */
+ if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
+ (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
+ if ( ! HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) ) {
+ hfa384x_int_rxmonitor( wlandev, rxfid, &rxdesc);
+ } else {
+ WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
+ }
+ goto done;
+ }
fc = ieee2host16(rxdesc.frame_control);
diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/hfa384x_usb.c linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x_usb.c
--- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/hfa384x_usb.c 2005-01-17 17:24:40.000000000 +0100
+++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/hfa384x_usb.c 2005-03-14 15:27:57.000000000 +0100
@@ -1143,8 +1143,14 @@
DBFENTER;
- cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
- HFA384x_CMD_AINFO_SET(enable);
+ if (enable == HFA384x_MONITOR_ENABLE) {
+ // KoreK: get into test mode 0x0a
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(0x0a);
+ } else {
+ cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+ HFA384x_CMD_AINFO_SET(enable);
+ }
cmd.parm0 = 0;
cmd.parm1 = 0;
cmd.parm2 = 0;
@@ -3258,37 +3264,59 @@
HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) |
HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0);
#endif
- hw->txbuff.txfrm.desc.tx_control =
- host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
- /* copy the header over to the txdesc */
- memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
+ if (skb->protocol != htons(ETH_P_80211_RAW)) {
+ hw->txbuff.txfrm.desc.tx_control =
+ host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+
+ /* copy the header over to the txdesc */
+ memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
+ sizeof(p80211_hdr_t));
+
+ /* if we're using host WEP, increase size by IV+ICV */
+ if (p80211_wep->data) {
+ hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
+ // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+ usbpktlen+=8;
+ } else {
+ hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
+ }
+ } else {
+ /* KoreK: raw injection (monitor mode): pull the rest of
+ the header and ssanity check on txdesc.data_len */
+ memcpy(&(hw->txbuff.txfrm.desc.data_len), skb->data, 16);
+ skb_pull(skb,16);
+ if (hw->txbuff.txfrm.desc.data_len != host2hfa384x_16(skb->len)) {
+ printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
+ return 0;
+ }
- /* if we're using host WEP, increase size by IV+ICV */
- if (p80211_wep->data) {
- hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
- // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
- usbpktlen+=8;
- } else {
- hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
+ hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
+ hw->txbuff.txfrm.desc.tx_control =
+ host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+
+ /* copy the header over to the txdesc */
+ memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
+ sizeof(p80211_hdr_t));
}
usbpktlen += skb->len;
/* copy over the WEP IV if we are using host WEP */
ptr = hw->txbuff.txfrm.data;
- if (p80211_wep->data) {
+ if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
memcpy(ptr, p80211_wep->iv, sizeof(p80211_wep->iv));
ptr+= sizeof(p80211_wep->iv);
memcpy(ptr, p80211_wep->data, skb->len);
} else {
memcpy(ptr, skb->data, skb->len);
}
+
/* copy over the packet data */
ptr+= skb->len;
/* copy over the WEP ICV if we are using host WEP */
- if (p80211_wep->data) {
+ if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
memcpy(ptr, p80211_wep->icv, sizeof(p80211_wep->icv));
}
@@ -4105,6 +4133,17 @@
switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status))
{
case 0:
+ /* KoreK: this testmode uses macport 0 */
+ if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
+ (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
+ if ( ! HFA384x_RXSTATUS_ISFCSERR(usbin->rxfrm.desc.status) ) {
+ hfa384x_int_rxmonitor(wlandev, &usbin->rxfrm);
+ } else {
+ WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
+ }
+ goto done;
+ }
+
w_hdr = (p80211_hdr_t *) &(usbin->rxfrm.desc.frame_control);
fc = ieee2host16(usbin->rxfrm.desc.frame_control);
diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/prism2mgmt.c linux-wlan-ng-0.2.1-pre26/src/prism2/driver/prism2mgmt.c
--- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/prism2mgmt.c 2005-01-25 01:38:50.000000000 +0100
+++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/prism2mgmt.c 2005-03-14 13:58:11.000000000 +0100
@@ -2855,9 +2855,10 @@
}
/* Now if we're already sniffing, we can skip the rest */
- if (wlandev->netdev->type != ARPHRD_ETHER) {
+ if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
+ (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
/* Set the port type to pIbss */
- word = HFA384x_PORTTYPE_PSUEDOIBSS;
+ word = 5; // HFA384x_PORTTYPE_PSUEDOIBSS;
result = hfa384x_drvr_setconfig16(hw,
HFA384x_RID_CNFPORTTYPE, word);
if ( result ) {
@@ -2869,6 +2870,8 @@
}
if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) {
/* Set the wepflags for no decryption */
+ /* doesn't work - done from the CLI */
+ /* Fix? KoreK */
word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT |
HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word);
@@ -2914,7 +2917,8 @@
goto failed;
}
- if (wlandev->netdev->type == ARPHRD_ETHER) {
+ if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
+ (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
WLAN_LOG_INFO("monitor mode enabled\n");
}
diff -ur linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/prism2sta.c linux-wlan-ng-0.2.1-pre26/src/prism2/driver/prism2sta.c
--- linux-wlan-ng-0.2.1-pre26-orig/src/prism2/driver/prism2sta.c 2005-01-25 01:38:50.000000000 +0100
+++ linux-wlan-ng-0.2.1-pre26/src/prism2/driver/prism2sta.c 2005-03-14 13:58:11.000000000 +0100
@@ -649,7 +649,8 @@
DBFENTER;
/* If necessary, set the 802.11 WEP bit */
- if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
+ if (((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED)
+ && (skb->protocol != htons(ETH_P_80211_RAW))) {
p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1));
} |
Patch | aircrack-ng/patches/old/wrt54g.patch | --- airodump-ng.c 2006-04-24 01:29:17.578125000 +0200
+++ airodump-ng-patched.c 2006-05-01 16:28:07.531250000 +0200
@@ -1690,37 +1690,54 @@
int pid, status;
struct iwreq wrq;
- if( G.is_wlanng )
- {
- if( ( pid = fork() ) == 0 )
- {
- close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
- execlp( "wlanctl-ng", "wlanctl-ng", interface,
- "lnxreq_wlansniff", "enable=true",
- "prismheader=true", "wlanheader=false",
- "stripfcs=true", "keepwepflags=true", NULL );
- exit( 1 );
- }
-
- waitpid( pid, &status, 0 );
-
- if( WIFEXITED(status) )
- return( WEXITSTATUS(status) );
- return( 1 );
- }
-
- memset( &wrq, 0, sizeof( struct iwreq ) );
- strncpy( wrq.ifr_name, interface, IFNAMSIZ );
- wrq.u.mode = IW_MODE_MONITOR;
-
- if( ioctl( fd_raw, SIOCSIWMODE, &wrq ) < 0 )
- {
- perror( "ioctl(SIOCSIWMODE) failed" );
- return( 1 );
- }
-
- set_channel( interface, fd_raw, 10 );
-
+ if( strcmp(interface,"prism0") == 0 )
+ {
+ if( ( pid = fork() ) == 0 )
+ {
+ close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+ execlp( "wl", "wl", "monitor", "1", NULL);
+ exit( 1 );
+ }
+ waitpid(pid, &status,0);
+ if( WIFEXITED(status) )
+ return( WEXITSTATUS(status) );
+ return( 1 );
+ }
+ else
+ {
+ if( G.is_wlanng )
+ {
+ if( ( pid = fork() ) == 0 )
+ {
+ close( 0 ); close( 1 ); close( 2 ); chdir( "/" );
+ execlp( "wlanctl-ng", "wlanctl-ng", interface,
+ "lnxreq_wlansniff", "enable=true",
+ "prismheader=true", "wlanheader=false",
+ "stripfcs=true", "keepwepflags=true", NULL );
+ exit( 1 );
+ }
+
+ waitpid( pid, &status, 0 );
+
+ if( WIFEXITED(status) )
+ return( WEXITSTATUS(status) );
+ return( 1 );
+ }
+
+ memset( &wrq, 0, sizeof( struct iwreq ) );
+ strncpy( wrq.ifr_name, interface, IFNAMSIZ );
+ wrq.u.mode = IW_MODE_MONITOR;
+
+ if( ioctl( fd_raw, SIOCSIWMODE, &wrq ) < 0 )
+ {
+ perror( "ioctl(SIOCSIWMODE) failed" );
+ return( 1 );
+ }
+
+ }
+
+ set_channel( interface, fd_raw, 10 );
+
return( 0 );
} |
Patch | aircrack-ng/patches/old/zd1211rw-inject+dbi-fix-2.6.26.patch | --- drivers/net/wireless/zd1211rw/zd_mac.c
+++ drivers/net/wireless/zd1211rw/zd_mac.c
@@ -221,14 +221,19 @@ void zd_mac_clear(struct zd_mac *mac)
static int set_rx_filter(struct zd_mac *mac)
{
unsigned long flags;
- u32 filter = STA_RX_FILTER;
+ struct zd_ioreq32 ioreqs[] = {
+ {CR_RX_FILTER, STA_RX_FILTER},
+ { CR_SNIFFER_ON, 0U },
+ };
spin_lock_irqsave(&mac->lock, flags);
- if (mac->pass_ctrl)
- filter |= RX_FILTER_CTRL;
+ if (mac->pass_ctrl) {
+ ioreqs[0].value |= 0xFFFFFFFF;
+ ioreqs[1].value = 0x1;
+ }
spin_unlock_irqrestore(&mac->lock, flags);
- return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
+ return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
}
static int set_mc_hash(struct zd_mac *mac)
@@ -815,7 +820,8 @@ int zd_mac_rx(struct ieee80211_hw *hw, c
/* Caller has to ensure that length >= sizeof(struct rx_status). */
status = (struct rx_status *)
(buffer + (length - sizeof(struct rx_status)));
- if (status->frame_status & ZD_RX_ERROR) {
+ if ((status->frame_status & ZD_RX_ERROR) ||
+ (status->frame_status & ~0x21)) {
if (mac->pass_failed_fcs &&
(status->frame_status & ZD_RX_CRC32_ERROR)) {
stats.flag |= RX_FLAG_FAILED_FCS_CRC;
@@ -828,7 +834,8 @@ int zd_mac_rx(struct ieee80211_hw *hw, c
stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq;
stats.band = IEEE80211_BAND_2GHZ;
stats.signal = status->signal_strength;
-
+ stats.signal = stats.signal - 90;
+
rate = zd_rx_rate(buffer, status);
/* todo: return index in the big switches in zd_rx_rate instead */
@@ -1155,7 +1162,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(str
hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
- IEEE80211_HW_SIGNAL_UNSPEC;
+ IEEE80211_HW_SIGNAL_DBM;
hw->wiphy->interface_modes =
BIT(NL80211_IFTYPE_MESH_POINT) | |
Patch | aircrack-ng/patches/old/zd1211rw-inject+dbi-fix-2.6.39.2.2.patch | diff -Naur linux/drivers/net/wireless/zd1211rw/zd_mac.c zdpats/drivers/net/wireless/zd1211rw/zd_mac.c
--- linux/drivers/net/wireless/zd1211rw/zd_mac.c 2011-05-19 06:06:34.000000000 +0200
+++ zdpats/drivers/net/wireless/zd1211rw/zd_mac.c 2011-06-25 17:46:33.146013429 +0200
@@ -227,14 +227,19 @@
static int set_rx_filter(struct zd_mac *mac)
{
unsigned long flags;
- u32 filter = STA_RX_FILTER;
+ struct zd_ioreq32 ioreqs[] = {
+ {CR_RX_FILTER, STA_RX_FILTER},
+ { CR_SNIFFER_ON, 0U },
+ };
spin_lock_irqsave(&mac->lock, flags);
- if (mac->pass_ctrl)
- filter |= RX_FILTER_CTRL;
+ if (mac->pass_ctrl) {
+ ioreqs[0].value |= 0xFFFFFFFF;
+ ioreqs[1].value = 0x1;
+ }
spin_unlock_irqrestore(&mac->lock, flags);
- return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
+ return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
}
static int set_mac_and_bssid(struct zd_mac *mac)
@@ -970,7 +975,8 @@
/* Caller has to ensure that length >= sizeof(struct rx_status). */
status = (struct rx_status *)
(buffer + (length - sizeof(struct rx_status)));
- if (status->frame_status & ZD_RX_ERROR) {
+ if ((status->frame_status & ZD_RX_ERROR) ||
+ (status->frame_status & ~0x21)) {
if (mac->pass_failed_fcs &&
(status->frame_status & ZD_RX_CRC32_ERROR)) {
stats.flag |= RX_FLAG_FAILED_FCS_CRC;
@@ -983,7 +989,8 @@
stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq;
stats.band = IEEE80211_BAND_2GHZ;
stats.signal = status->signal_strength;
-
+ stats.signal = stats.signal - 90;
+
rate = zd_rx_rate(buffer, status);
/* todo: return index in the big switches in zd_rx_rate instead */
@@ -1312,7 +1319,7 @@
hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
- IEEE80211_HW_SIGNAL_UNSPEC |
+ IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING;
hw->wiphy->interface_modes = |
aircrack-ng/patches/old/zd1211rw-inject+dbi-fix-2.6.39.4.diff | diff -Naur linux/drivers/net/wireless/zd1211rw/zd_mac.c linux/drivers/net/wireless/zd1211rw/zd_mac.c
--- linux/drivers/net/wireless/zd1211rw/zd_mac.c 2011-05-19 06:06:34.000000000 +0200
+++ linux/drivers/net/wireless/zd1211rw/zd_mac.c 2011-08-21 17:46:33.146013429 +0200
@@ -983,7 +989,8 @@
stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq;
stats.band = IEEE80211_BAND_2GHZ;
stats.signal = status->signal_strength;
-
+ stats.signal = stats.signal - 90;
+
rate = zd_rx_rate(buffer, status);
/* todo: return index in the big switches in zd_rx_rate instead */
@@ -1312,7 +1319,7 @@
hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
- IEEE80211_HW_SIGNAL_UNSPEC |
+ IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING;
hw->wiphy->interface_modes = |
|
Patch | aircrack-ng/patches/old/zd1211rw-inject+dbi-fix-3.3.2.patch | --- linux/drivers/net/wireless/zd1211rw.bak/zd_mac.c 2012-03-19 00:15:34.000000000 +0100
+++ linux/drivers/net/wireless/zd1211rw/zd_mac.c 2012-04-17 14:07:20.962966310 +0200
@@ -243,14 +243,19 @@
static int set_rx_filter(struct zd_mac *mac)
{
unsigned long flags;
- u32 filter = STA_RX_FILTER;
+ struct zd_ioreq32 ioreqs[] = {
+ {CR_RX_FILTER, STA_RX_FILTER},
+ { CR_SNIFFER_ON, 0U },
+ };
spin_lock_irqsave(&mac->lock, flags);
- if (mac->pass_ctrl)
- filter |= RX_FILTER_CTRL;
+ if (mac->pass_ctrl) {
+ ioreqs[0].value |= 0xFFFFFFFF;
+ ioreqs[1].value = 0x1;
+ }
spin_unlock_irqrestore(&mac->lock, flags);
- return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
+ return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
}
static int set_mac_and_bssid(struct zd_mac *mac)
@@ -1047,7 +1052,8 @@
/* Caller has to ensure that length >= sizeof(struct rx_status). */
status = (struct rx_status *)
(buffer + (length - sizeof(struct rx_status)));
- if (status->frame_status & ZD_RX_ERROR) {
+ if ((status->frame_status & ZD_RX_ERROR) ||
+ (status->frame_status & ~0x21)) {
if (mac->pass_failed_fcs &&
(status->frame_status & ZD_RX_CRC32_ERROR)) {
stats.flag |= RX_FLAG_FAILED_FCS_CRC;
@@ -1060,6 +1066,7 @@
stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq;
stats.band = IEEE80211_BAND_2GHZ;
stats.signal = zd_check_signal(hw, status->signal_strength);
+ stats.signal = stats.signal - 90;
rate = zd_rx_rate(buffer, status);
@@ -1388,7 +1395,7 @@
hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
- IEEE80211_HW_SIGNAL_UNSPEC |
+ IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING;
hw->wiphy->interface_modes = |
Patch | aircrack-ng/patches/old/zd1211rw_inject-2.6.20-gentoo-r4.patch | diff -ur linux-2.6.20-gentoo-r4/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.20-gentoo-r4-inject/drivers/net/wireless/zd1211rw/zd_mac.c
--- linux-2.6.20-gentoo-r4/drivers/net/wireless/zd1211rw/zd_mac.c 2007-04-03 00:53:39.000000000 -0400
+++ linux-2.6.20-gentoo-r4-inject/drivers/net/wireless/zd1211rw/zd_mac.c 2007-04-03 00:50:05.000000000 -0400
@@ -202,7 +202,16 @@
goto disable_rx;
housekeeping_enable(mac);
+
+ netif_carrier_on(netdev);
+
ieee80211softmac_start(netdev);
+
+ if(!netif_queue_stopped(netdev))
+ netif_start_queue(netdev);
+ else
+ netif_wake_queue(netdev);
+
return 0;
disable_rx:
zd_chip_disable_rx(chip);
@@ -929,6 +938,8 @@
u8 rt_rate;
u16 rt_channel;
u16 rt_chbitmask;
+ u8 rt_antsignal;
+ u8 rt_antnoise;
} __attribute__((packed));
static void fill_rt_header(void *buffer, struct zd_mac *mac,
@@ -942,7 +953,9 @@
hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr));
hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_CHANNEL) |
- (1 << IEEE80211_RADIOTAP_RATE));
+ (1 << IEEE80211_RADIOTAP_RATE) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE));
hdr->rt_flags = 0;
if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
@@ -956,6 +969,12 @@
hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
+
+ hdr->rt_antsignal = status->signal_strength;
+ if(status->frame_status & ZD_RX_OFDM)
+ hdr->rt_antnoise = status->signal_strength - status->signal_quality_ofdm;
+ else
+ hdr->rt_antnoise = status->signal_strength - status->signal_quality_cck;
}
/* Returns 1 if the data packet is for us and 0 otherwise. */
@@ -1062,7 +1081,8 @@
const struct rx_status *status;
*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
- if (status->frame_status & ZD_RX_ERROR) {
+ if (status->frame_status & ZD_RX_ERROR
+ || status->frame_status & ~0x21) {
/* FIXME: update? */
return -EINVAL;
}
Only in linux-2.6.20-gentoo-r4-inject/include: config
diff -ur linux-2.6.20-gentoo-r4/net/ieee80211/ieee80211_tx.c linux-2.6.20-gentoo-r4-inject/net/ieee80211/ieee80211_tx.c
--- linux-2.6.20-gentoo-r4/net/ieee80211/ieee80211_tx.c 2007-04-03 00:53:44.000000000 -0400
+++ linux-2.6.20-gentoo-r4-inject/net/ieee80211/ieee80211_tx.c 2007-04-03 00:45:52.000000000 -0400
@@ -291,6 +291,24 @@
goto success;
}
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ txb = ieee80211_alloc_txb(1, skb->len,
+ ieee->tx_headroom, GFP_ATOMIC);
+ if (unlikely(!txb)) {
+ printk(KERN_WARNING "%s: Could not allocate TXB\n",
+ ieee->dev->name);
+ goto failed;
+ }
+
+ txb->encrypted = 0;
+ txb->payload_size = skb->len;
+ memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
+
+ goto success;
+ }
+
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
crypt = ieee->crypt[ieee->tx_keyidx];
Only in linux-2.6.20-gentoo-r4-inject/scripts/basic: .docproc.cmd
Only in linux-2.6.20-gentoo-r4-inject/scripts/basic: .fixdep.cmd
Only in linux-2.6.20-gentoo-r4-inject/scripts/basic: docproc
Only in linux-2.6.20-gentoo-r4-inject/scripts/basic: fixdep
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: .conf.o.cmd
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: .kconfig_load.o.cmd
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: .kxgettext.o.cmd
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: .qconf.cmd
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: .qconf.o.cmd
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: .tmp_qtcheck
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: .zconf.tab.o.cmd
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: conf
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: conf.o
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: kconfig_load.o
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: kxgettext.o
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: lex.zconf.c
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: lkc_defs.h
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: mconf
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: qconf
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: qconf.moc
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: qconf.o
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: zconf.hash.c
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: zconf.tab.c
Only in linux-2.6.20-gentoo-r4-inject/scripts/kconfig: zconf.tab.o |
Patch | aircrack-ng/patches/old/zd1211rw_inject.patch | --- linux-source-2.6.17-orig/net/ieee80211/ieee80211_tx.c 2006-10-13 14:18:10.000000000 +0200
+++ linux/net/ieee80211/ieee80211_tx.c 2007-04-02 23:57:25.000000000 +0200
@@ -291,6 +291,23 @@
goto success;
}
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ {
+ txb = ieee80211_alloc_txb(1, skb->len,
+ ieee->tx_headroom, GFP_ATOMIC);
+ if (unlikely(!txb)) {
+ printk(KERN_WARNING "%s: Could not allocate TXB\n",
+ ieee->dev->name);
+ goto failed;
+ }
+
+ txb->encrypted = 0;
+ txb->payload_size = skb->len;
+ memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
+
+ goto success;
+ }
+
ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
crypt = ieee->crypt[ieee->tx_keyidx];
--- linux-source-2.6.17-orig/drivers/net/wireless/zd1211rw/zd_mac.c 2006-10-01 18:42:47.000000000 +0200
+++ linux/drivers/net/wireless/zd1211rw/zd_mac.c 2007-04-03 00:01:52.000000000 +0200
@@ -180,7 +180,16 @@
if (r < 0)
goto disable_rx;
+ netif_carrier_on(netdev);
+
ieee80211softmac_start(netdev);
+
+ if(!netif_queue_stopped(netdev))
+ netif_start_queue(netdev);
+ else
+ netif_wake_queue(netdev);
+
+
return 0;
disable_rx:
zd_chip_disable_rx(chip);
@@ -716,6 +725,8 @@
u8 rt_rate;
u16 rt_channel;
u16 rt_chbitmask;
+ u8 rt_antsignal;
+ u8 rt_antnoise;
} __attribute__((packed));
static void fill_rt_header(void *buffer, struct zd_mac *mac,
@@ -729,7 +740,9 @@
hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr));
hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_CHANNEL) |
- (1 << IEEE80211_RADIOTAP_RATE));
+ (1 << IEEE80211_RADIOTAP_RATE) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE));
hdr->rt_flags = 0;
if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
@@ -743,6 +756,12 @@
hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
+
+ hdr->rt_antsignal = status->signal_strength;
+ if(status->frame_status & ZD_RX_OFDM)
+ hdr->rt_antnoise = status->signal_strength - status->signal_quality_ofdm;
+ else
+ hdr->rt_antnoise = status->signal_strength - status->signal_quality_cck;
}
/* Returns 1 if the data packet is for us and 0 otherwise. */
@@ -834,7 +853,8 @@
const struct rx_status *status;
*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
- if (status->frame_status & ZD_RX_ERROR) {
+ if (status->frame_status & ZD_RX_ERROR
+ || status->frame_status & ~0x21) {
/* FIXME: update? */
return -EINVAL;
} |
Patch | aircrack-ng/patches/old/zd1211rw_inject_2.6.17.patch | diff -Naur linux-source-2.6.17-orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-source-2.6.17-rawtx/drivers/net/wireless/zd1211rw/zd_mac.c
--- linux-source-2.6.17-orig/drivers/net/wireless/zd1211rw/zd_mac.c 2006-10-01 18:42:47.000000000 +0200
+++ linux-source-2.6.17-rawtx/drivers/net/wireless/zd1211rw/zd_mac.c 2007-04-16 01:32:09.000000000 +0200
@@ -180,7 +180,16 @@
if (r < 0)
goto disable_rx;
+ netif_carrier_on(netdev);
+
ieee80211softmac_start(netdev);
+
+ if(!netif_queue_stopped(netdev))
+ netif_start_queue(netdev);
+ else
+ netif_wake_queue(netdev);
+
+
return 0;
disable_rx:
zd_chip_disable_rx(chip);
@@ -622,6 +631,7 @@
struct ieee80211_txb *txb,
int frag_num)
{
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
int r;
struct sk_buff *skb = txb->fragments[frag_num];
struct ieee80211_hdr_4addr *hdr =
@@ -645,7 +655,10 @@
cs->tx_length = cpu_to_le16(frag_len);
- cs_set_control(mac, cs, hdr);
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ cs->control = ZD_CS_MULTICAST;
+ else
+ cs_set_control(mac, cs, hdr);
packet_length = frag_len + sizeof(struct zd_ctrlset) + 10;
ZD_ASSERT(packet_length <= 0xffff);
@@ -690,6 +703,7 @@
static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri)
{
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
int i, r;
for (i = 0; i < txb->nr_frags; i++) {
@@ -698,7 +712,10 @@
r = fill_ctrlset(mac, txb, i);
if (r)
return r;
- r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ r = zd_usb_tx_inject(&mac->chip.usb, skb->data, skb->len);
+ else
+ r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
if (r)
return r;
}
@@ -716,6 +733,8 @@
u8 rt_rate;
u16 rt_channel;
u16 rt_chbitmask;
+ u8 rt_antsignal;
+ u8 rt_antnoise;
} __attribute__((packed));
static void fill_rt_header(void *buffer, struct zd_mac *mac,
@@ -729,7 +748,9 @@
hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr));
hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_CHANNEL) |
- (1 << IEEE80211_RADIOTAP_RATE));
+ (1 << IEEE80211_RADIOTAP_RATE) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE));
hdr->rt_flags = 0;
if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
@@ -743,6 +764,9 @@
hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
+
+ hdr->rt_antsignal = status->signal_strength;
+ hdr->rt_antnoise = stats->noise;
}
/* Returns 1 if the data packet is for us and 0 otherwise. */
@@ -834,7 +858,8 @@
const struct rx_status *status;
*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
- if (status->frame_status & ZD_RX_ERROR) {
+ if (status->frame_status & ZD_RX_ERROR
+ || status->frame_status & ~0x21) {
/* FIXME: update? */
return -EINVAL;
}
diff -Naur linux-source-2.6.17-orig/drivers/net/wireless/zd1211rw/zd_usb.c linux-source-2.6.17-rawtx/drivers/net/wireless/zd1211rw/zd_usb.c
--- linux-source-2.6.17-orig/drivers/net/wireless/zd1211rw/zd_usb.c 2006-10-04 05:35:08.000000000 +0200
+++ linux-source-2.6.17-rawtx/drivers/net/wireless/zd1211rw/zd_usb.c 2007-04-09 16:07:16.000000000 +0200
@@ -42,6 +42,7 @@
/* ZD1211B */
{ USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B },
+ { USB_DEVICE(0x083a, 0x4505), .driver_info = DEVICE_ZD1211B },
{}
};
@@ -805,6 +806,46 @@
return r;
}
+/* Puts the frame on the USB endpoint. It doesn't wait for
+ * completion. The frame must contain the control set.
+ */
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length)
+{
+ int r;
+ struct usb_device *udev = zd_usb_to_usbdev(usb);
+ struct urb *urb;
+ void *buffer;
+
+ urb = usb_alloc_urb(0, GFP_ATOMIC);
+ if (!urb) {
+ r = -ENOMEM;
+ goto out;
+ }
+
+ buffer = usb_buffer_alloc(zd_usb_to_usbdev(usb), length, GFP_ATOMIC,
+ &urb->transfer_dma);
+ if (!buffer) {
+ r = -ENOMEM;
+ goto error_free_urb;
+ }
+ memcpy(buffer, frame, length);
+
+ usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT),
+ buffer, length, tx_urb_complete, NULL);
+
+ r = usb_submit_urb(urb, GFP_ATOMIC);
+ if (r)
+ goto error;
+ return 0;
+error:
+ usb_buffer_free(zd_usb_to_usbdev(usb), length, buffer,
+ urb->transfer_dma);
+error_free_urb:
+ usb_free_urb(urb);
+out:
+ return r;
+}
+
static inline void init_usb_interrupt(struct zd_usb *usb)
{
struct zd_usb_interrupt *intr = &usb->intr;
diff -Naur linux-source-2.6.17-orig/drivers/net/wireless/zd1211rw/zd_usb.h linux-source-2.6.17-rawtx/drivers/net/wireless/zd1211rw/zd_usb.h
--- linux-source-2.6.17-orig/drivers/net/wireless/zd1211rw/zd_usb.h 2006-10-01 18:42:47.000000000 +0200
+++ linux-source-2.6.17-rawtx/drivers/net/wireless/zd1211rw/zd_usb.h 2007-04-09 16:07:21.000000000 +0200
@@ -222,6 +222,7 @@
void zd_usb_disable_rx(struct zd_usb *usb);
int zd_usb_tx(struct zd_usb *usb, const u8 *frame, unsigned int length);
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length);
int zd_usb_ioread16v(struct zd_usb *usb, u16 *values,
const zd_addr_t *addresses, unsigned int count); |
Patch | aircrack-ng/patches/old/zd1211rw_inject_2.6.20.patch | diff -Naur linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_mac.c
--- linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_mac.c 2007-03-23 20:52:51.000000000 +0100
+++ linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_mac.c 2007-04-16 01:53:58.000000000 +0200
@@ -202,7 +202,13 @@
goto disable_rx;
housekeeping_enable(mac);
+ netif_carrier_on(netdev);
ieee80211softmac_start(netdev);
+ if(!netif_queue_stopped(netdev))
+ netif_start_queue(netdev);
+ else
+ netif_wake_queue(netdev);
+
return 0;
disable_rx:
zd_chip_disable_rx(chip);
@@ -835,6 +841,7 @@
struct ieee80211_txb *txb,
int frag_num)
{
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
int r;
struct sk_buff *skb = txb->fragments[frag_num];
struct ieee80211_hdr_4addr *hdr =
@@ -858,7 +865,10 @@
cs->tx_length = cpu_to_le16(frag_len);
- cs_set_control(mac, cs, hdr);
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ cs->control = ZD_CS_MULTICAST;
+ else
+ cs_set_control(mac, cs, hdr);
packet_length = frag_len + sizeof(struct zd_ctrlset) + 10;
ZD_ASSERT(packet_length <= 0xffff);
@@ -903,6 +913,7 @@
static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri)
{
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
int i, r;
for (i = 0; i < txb->nr_frags; i++) {
@@ -911,7 +922,10 @@
r = fill_ctrlset(mac, txb, i);
if (r)
return r;
- r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ r = zd_usb_tx_inject(&mac->chip.usb, skb->data, skb->len);
+ else
+ r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
if (r)
return r;
}
@@ -929,6 +943,8 @@
u8 rt_rate;
u16 rt_channel;
u16 rt_chbitmask;
+ u8 rt_antsignal;
+ u8 rt_antnoise;
} __attribute__((packed));
static void fill_rt_header(void *buffer, struct zd_mac *mac,
@@ -942,7 +958,9 @@
hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr));
hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_CHANNEL) |
- (1 << IEEE80211_RADIOTAP_RATE));
+ (1 << IEEE80211_RADIOTAP_RATE) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE));
hdr->rt_flags = 0;
if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
@@ -956,6 +974,9 @@
hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
+
+ hdr->rt_antsignal = status->signal_strength;
+ hdr->rt_antnoise = stats->noise;
}
/* Returns 1 if the data packet is for us and 0 otherwise. */
@@ -1062,7 +1083,8 @@
const struct rx_status *status;
*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
- if (status->frame_status & ZD_RX_ERROR) {
+ if (status->frame_status & ZD_RX_ERROR
+ || status->frame_status & ~0x21) {
/* FIXME: update? */
return -EINVAL;
}
diff -Naur linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_usb.c linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_usb.c
--- linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_usb.c 2007-03-23 20:52:51.000000000 +0100
+++ linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_usb.c 2007-04-09 22:49:51.000000000 +0200
@@ -58,6 +58,7 @@
{ USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x050d, 0x705c), .driver_info = DEVICE_ZD1211B },
+ { USB_DEVICE(0x083a, 0x4505), .driver_info = DEVICE_ZD1211B },
/* "Driverless" devices that need ejecting */
{ USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
{}
@@ -851,6 +852,46 @@
return r;
}
+/* Puts the frame on the USB endpoint. It doesn't wait for
+ * completion. The frame must contain the control set.
+ */
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length)
+{
+ int r;
+ struct usb_device *udev = zd_usb_to_usbdev(usb);
+ struct urb *urb;
+ void *buffer;
+
+ urb = usb_alloc_urb(0, GFP_ATOMIC);
+ if (!urb) {
+ r = -ENOMEM;
+ goto out;
+ }
+
+ buffer = usb_buffer_alloc(zd_usb_to_usbdev(usb), length, GFP_ATOMIC,
+ &urb->transfer_dma);
+ if (!buffer) {
+ r = -ENOMEM;
+ goto error_free_urb;
+ }
+ memcpy(buffer, frame, length);
+
+ usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT),
+ buffer, length, tx_urb_complete, NULL);
+
+ r = usb_submit_urb(urb, GFP_ATOMIC);
+ if (r)
+ goto error;
+ return 0;
+error:
+ usb_buffer_free(zd_usb_to_usbdev(usb), length, buffer,
+ urb->transfer_dma);
+error_free_urb:
+ usb_free_urb(urb);
+out:
+ return r;
+}
+
static inline void init_usb_interrupt(struct zd_usb *usb)
{
struct zd_usb_interrupt *intr = &usb->intr;
diff -Naur linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_usb.h linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_usb.h
--- linux-2.6.20.4-orig/drivers/net/wireless/zd1211rw/zd_usb.h 2007-03-23 20:52:51.000000000 +0100
+++ linux-2.6.20.4-rawtx/drivers/net/wireless/zd1211rw/zd_usb.h 2007-04-09 22:42:11.000000000 +0200
@@ -223,6 +223,7 @@
void zd_usb_disable_rx(struct zd_usb *usb);
int zd_usb_tx(struct zd_usb *usb, const u8 *frame, unsigned int length);
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length);
int zd_usb_ioread16v(struct zd_usb *usb, u16 *values,
const zd_addr_t *addresses, unsigned int count); |
Patch | aircrack-ng/patches/old/zd1211rw_inject_2.6.21-gentoo.patch | diff -ur linux-2.6.21-gentoo-orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.21-gentoo-rawtx/drivers/net/wireless/zd1211rw/zd_mac.c
--- linux-2.6.21-gentoo-orig/drivers/net/wireless/zd1211rw/zd_mac.c 2007-04-27 17:23:31.000000000 -0400
+++ linux-2.6.21-gentoo-rawtx/drivers/net/wireless/zd1211rw/zd_mac.c 2007-04-27 18:32:21.000000000 -0400
@@ -201,7 +201,13 @@
goto disable_rx;
housekeeping_enable(mac);
- ieee80211softmac_start(netdev);
+ netif_carrier_on(netdev);
+ ieee80211softmac_start(netdev);
+ if(!netif_queue_stopped(netdev))
+ netif_start_queue(netdev);
+ else
+ netif_wake_queue(netdev);
+
return 0;
disable_rx:
zd_chip_disable_rx(chip);
@@ -834,6 +840,7 @@
struct ieee80211_txb *txb,
int frag_num)
{
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
int r;
struct sk_buff *skb = txb->fragments[frag_num];
struct ieee80211_hdr_4addr *hdr =
@@ -857,7 +864,10 @@
cs->tx_length = cpu_to_le16(frag_len);
- cs_set_control(mac, cs, hdr);
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ cs->control = ZD_CS_MULTICAST;
+ else
+ cs_set_control(mac, cs, hdr);
packet_length = frag_len + sizeof(struct zd_ctrlset) + 10;
ZD_ASSERT(packet_length <= 0xffff);
@@ -913,7 +923,11 @@
ieee->stats.tx_dropped++;
return r;
}
- r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ r = zd_usb_tx_inject(&mac->chip.usb, skb->data, skb->len);
+ else
+ r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
if (r) {
ieee->stats.tx_dropped++;
return r;
@@ -933,6 +947,8 @@
u8 rt_rate;
u16 rt_channel;
u16 rt_chbitmask;
+ u8 rt_antsignal;
+ u8 rt_antnoise;
} __attribute__((packed));
static void fill_rt_header(void *buffer, struct zd_mac *mac,
@@ -946,7 +962,9 @@
hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr));
hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_CHANNEL) |
- (1 << IEEE80211_RADIOTAP_RATE));
+ (1 << IEEE80211_RADIOTAP_RATE) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE));
hdr->rt_flags = 0;
if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
@@ -960,6 +978,9 @@
hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
+
+ hdr->rt_antsignal = status->signal_strength;
+ hdr->rt_antnoise = stats->noise;
}
/* Returns 1 if the data packet is for us and 0 otherwise. */
@@ -1066,7 +1087,8 @@
const struct rx_status *status;
*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
- if (status->frame_status & ZD_RX_ERROR) {
+ if (status->frame_status & ZD_RX_ERROR
+ || status->frame_status & ~0x21) {
struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
ieee->stats.rx_errors++;
if (status->frame_status & ZD_RX_TIMEOUT_ERROR)
diff -ur linux-2.6.21-gentoo-orig/drivers/net/wireless/zd1211rw/zd_usb.c linux-2.6.21-gentoo-rawtx/drivers/net/wireless/zd1211rw/zd_usb.c
--- linux-2.6.21-gentoo-orig/drivers/net/wireless/zd1211rw/zd_usb.c 2007-04-27 17:23:31.000000000 -0400
+++ linux-2.6.21-gentoo-rawtx/drivers/net/wireless/zd1211rw/zd_usb.c 2007-04-27 17:59:07.000000000 -0400
@@ -63,6 +63,7 @@
{ USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0586, 0x340f), .driver_info = DEVICE_ZD1211B },
{ USB_DEVICE(0x0baf, 0x0121), .driver_info = DEVICE_ZD1211B },
+ { USB_DEVICE(0x083a, 0x4505), .driver_info = DEVICE_ZD1211B },
/* "Driverless" devices that need ejecting */
{ USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
{}
@@ -773,6 +774,46 @@
return r;
}
+/* Puts the frame on the USB endpoint. It doesn't wait for
+ * completion. The frame must contain the control set.
+ */
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length)
+{
+ int r;
+ struct usb_device *udev = zd_usb_to_usbdev(usb);
+ struct urb *urb;
+ void *buffer;
+
+ urb = usb_alloc_urb(0, GFP_ATOMIC);
+ if (!urb) {
+ r = -ENOMEM;
+ goto out;
+ }
+
+ buffer = usb_buffer_alloc(zd_usb_to_usbdev(usb), length, GFP_ATOMIC,
+ &urb->transfer_dma);
+ if (!buffer) {
+ r = -ENOMEM;
+ goto error_free_urb;
+ }
+ memcpy(buffer, frame, length);
+
+ usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT),
+ buffer, length, tx_urb_complete, NULL);
+
+ r = usb_submit_urb(urb, GFP_ATOMIC);
+ if (r)
+ goto error;
+ return 0;
+error:
+ usb_buffer_free(zd_usb_to_usbdev(usb), length, buffer,
+ urb->transfer_dma);
+error_free_urb:
+ usb_free_urb(urb);
+out:
+ return r;
+}
+
static inline void init_usb_interrupt(struct zd_usb *usb)
{
struct zd_usb_interrupt *intr = &usb->intr;
diff -ur linux-2.6.21-gentoo-orig/drivers/net/wireless/zd1211rw/zd_usb.h linux-2.6.21-gentoo-rawtx/drivers/net/wireless/zd1211rw/zd_usb.h
--- linux-2.6.21-gentoo-orig/drivers/net/wireless/zd1211rw/zd_usb.h 2007-04-27 17:23:31.000000000 -0400
+++ linux-2.6.21-gentoo-rawtx/drivers/net/wireless/zd1211rw/zd_usb.h 2007-04-27 18:01:02.000000000 -0400
@@ -221,6 +221,7 @@
void zd_usb_disable_rx(struct zd_usb *usb);
int zd_usb_tx(struct zd_usb *usb, const u8 *frame, unsigned int length);
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length);
int zd_usb_ioread16v(struct zd_usb *usb, u16 *values,
const zd_addr_t *addresses, unsigned int count); |
Patch | aircrack-ng/patches/old/zd1211rw_inject_2.6.22.patch | diff -Naur linux-2.6.22_orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.22/drivers/net/wireless/zd1211rw/zd_mac.c
--- linux-2.6.22_orig/drivers/net/wireless/zd1211rw/zd_mac.c 2007-08-09 15:37:14.000000000 +0200
+++ linux-2.6.22/drivers/net/wireless/zd1211rw/zd_mac.c 2007-08-23 22:51:27.000000000 +0200
@@ -156,8 +156,17 @@
static int reset_mode(struct zd_mac *mac)
{
struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
- u32 filter = (ieee->iw_mode == IW_MODE_MONITOR) ? ~0 : STA_RX_FILTER;
- return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
+ struct zd_ioreq32 ioreqs[] = {
+ { CR_RX_FILTER, STA_RX_FILTER },
+ { CR_SNIFFER_ON, 0U },
+ };
+
+ if (ieee->iw_mode == IW_MODE_MONITOR) {
+ ioreqs[0].value = 0xffffffff;
+ ioreqs[1].value = 0x1;
+ }
+
+ return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
}
int zd_mac_open(struct net_device *netdev)
@@ -192,7 +201,13 @@
goto disable_rx;
housekeeping_enable(mac);
- ieee80211softmac_start(netdev);
+ netif_carrier_on(netdev);
+ ieee80211softmac_start(netdev);
+ if(!netif_queue_stopped(netdev))
+ netif_start_queue(netdev);
+ else
+ netif_wake_queue(netdev);
+
return 0;
disable_rx:
zd_chip_disable_rx(chip);
@@ -825,6 +840,7 @@
struct ieee80211_txb *txb,
int frag_num)
{
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
int r;
struct sk_buff *skb = txb->fragments[frag_num];
struct ieee80211_hdr_4addr *hdr =
@@ -848,7 +864,10 @@
cs->tx_length = cpu_to_le16(frag_len);
- cs_set_control(mac, cs, hdr);
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ cs->control = ZD_CS_MULTICAST;
+ else
+ cs_set_control(mac, cs, hdr);
packet_length = frag_len + sizeof(struct zd_ctrlset) + 10;
ZD_ASSERT(packet_length <= 0xffff);
@@ -904,7 +923,11 @@
ieee->stats.tx_dropped++;
return r;
}
- r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ r = zd_usb_tx_inject(&mac->chip.usb, skb->data, skb->len);
+ else
+ r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
if (r) {
ieee->stats.tx_dropped++;
return r;
@@ -924,6 +947,8 @@
u8 rt_rate;
u16 rt_channel;
u16 rt_chbitmask;
+ u8 rt_antsignal;
+ u8 rt_antnoise;
} __attribute__((packed));
static void fill_rt_header(void *buffer, struct zd_mac *mac,
@@ -937,7 +962,9 @@
hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr));
hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_CHANNEL) |
- (1 << IEEE80211_RADIOTAP_RATE));
+ (1 << IEEE80211_RADIOTAP_RATE) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE));
hdr->rt_flags = 0;
if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
@@ -951,6 +978,9 @@
hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
+
+ hdr->rt_antsignal = status->signal_strength;
+ hdr->rt_antnoise = stats->noise;
}
/* Returns 1 if the data packet is for us and 0 otherwise. */
@@ -1057,7 +1087,8 @@
const struct rx_status *status;
*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
- if (status->frame_status & ZD_RX_ERROR) {
+ if (status->frame_status & ZD_RX_ERROR
+ || status->frame_status & ~0x21) {
struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
ieee->stats.rx_errors++;
if (status->frame_status & ZD_RX_TIMEOUT_ERROR)
diff -Naur linux-2.6.22_orig/drivers/net/wireless/zd1211rw/zd_mac.c~ linux-2.6.22/drivers/net/wireless/zd1211rw/zd_mac.c~
--- linux-2.6.22_orig/drivers/net/wireless/zd1211rw/zd_mac.c~ 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.22/drivers/net/wireless/zd1211rw/zd_mac.c~ 2007-08-23 22:26:08.000000000 +0200
@@ -0,0 +1,1352 @@
+/* zd_mac.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/wireless.h>
+#include <linux/usb.h>
+#include <linux/jiffies.h>
+#include <net/ieee80211_radiotap.h>
+
+#include "zd_def.h"
+#include "zd_chip.h"
+#include "zd_mac.h"
+#include "zd_ieee80211.h"
+#include "zd_netdev.h"
+#include "zd_rf.h"
+#include "zd_util.h"
+
+static void ieee_init(struct ieee80211_device *ieee);
+static void softmac_init(struct ieee80211softmac_device *sm);
+static void set_rts_cts_work(struct work_struct *work);
+static void set_basic_rates_work(struct work_struct *work);
+
+static void housekeeping_init(struct zd_mac *mac);
+static void housekeeping_enable(struct zd_mac *mac);
+static void housekeeping_disable(struct zd_mac *mac);
+
+static void set_multicast_hash_handler(struct work_struct *work);
+
+static void do_rx(unsigned long mac_ptr);
+
+int zd_mac_init(struct zd_mac *mac,
+ struct net_device *netdev,
+ struct usb_interface *intf)
+{
+ struct ieee80211_device *ieee = zd_netdev_ieee80211(netdev);
+
+ memset(mac, 0, sizeof(*mac));
+ spin_lock_init(&mac->lock);
+ mac->netdev = netdev;
+ INIT_DELAYED_WORK(&mac->set_rts_cts_work, set_rts_cts_work);
+ INIT_DELAYED_WORK(&mac->set_basic_rates_work, set_basic_rates_work);
+
+ skb_queue_head_init(&mac->rx_queue);
+ tasklet_init(&mac->rx_tasklet, do_rx, (unsigned long)mac);
+ tasklet_disable(&mac->rx_tasklet);
+
+ ieee_init(ieee);
+ softmac_init(ieee80211_priv(netdev));
+ zd_chip_init(&mac->chip, netdev, intf);
+ housekeeping_init(mac);
+ INIT_WORK(&mac->set_multicast_hash_work, set_multicast_hash_handler);
+ return 0;
+}
+
+static int reset_channel(struct zd_mac *mac)
+{
+ int r;
+ unsigned long flags;
+ const struct channel_range *range;
+
+ spin_lock_irqsave(&mac->lock, flags);
+ range = zd_channel_range(mac->regdomain);
+ if (!range->start) {
+ r = -EINVAL;
+ goto out;
+ }
+ mac->requested_channel = range->start;
+ r = 0;
+out:
+ spin_unlock_irqrestore(&mac->lock, flags);
+ return r;
+}
+
+int zd_mac_init_hw(struct zd_mac *mac, u8 device_type)
+{
+ int r;
+ struct zd_chip *chip = &mac->chip;
+ u8 addr[ETH_ALEN];
+ u8 default_regdomain;
+
+ r = zd_chip_enable_int(chip);
+ if (r)
+ goto out;
+ r = zd_chip_init_hw(chip, device_type);
+ if (r)
+ goto disable_int;
+
+ zd_get_e2p_mac_addr(chip, addr);
+ r = zd_write_mac_addr(chip, addr);
+ if (r)
+ goto disable_int;
+ ZD_ASSERT(!irqs_disabled());
+ spin_lock_irq(&mac->lock);
+ memcpy(mac->netdev->dev_addr, addr, ETH_ALEN);
+ spin_unlock_irq(&mac->lock);
+
+ r = zd_read_regdomain(chip, &default_regdomain);
+ if (r)
+ goto disable_int;
+ if (!zd_regdomain_supported(default_regdomain)) {
+ dev_dbg_f(zd_mac_dev(mac),
+ "Regulatory Domain %#04x is not supported.\n",
+ default_regdomain);
+ r = -EINVAL;
+ goto disable_int;
+ }
+ spin_lock_irq(&mac->lock);
+ mac->regdomain = mac->default_regdomain = default_regdomain;
+ spin_unlock_irq(&mac->lock);
+ r = reset_channel(mac);
+ if (r)
+ goto disable_int;
+
+ /* We must inform the device that we are doing encryption/decryption in
+ * software at the moment. */
+ r = zd_set_encryption_type(chip, ENC_SNIFFER);
+ if (r)
+ goto disable_int;
+
+ r = zd_geo_init(zd_mac_to_ieee80211(mac), mac->regdomain);
+ if (r)
+ goto disable_int;
+
+ r = 0;
+disable_int:
+ zd_chip_disable_int(chip);
+out:
+ return r;
+}
+
+void zd_mac_clear(struct zd_mac *mac)
+{
+ flush_workqueue(zd_workqueue);
+ skb_queue_purge(&mac->rx_queue);
+ tasklet_kill(&mac->rx_tasklet);
+ zd_chip_clear(&mac->chip);
+ ZD_ASSERT(!spin_is_locked(&mac->lock));
+ ZD_MEMCLEAR(mac, sizeof(struct zd_mac));
+}
+
+static int reset_mode(struct zd_mac *mac)
+{
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
+ u32 filter = (ieee->iw_mode == IW_MODE_MONITOR) ? ~0 : STA_RX_FILTER;
+ return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
+}
+
+int zd_mac_open(struct net_device *netdev)
+{
+ struct zd_mac *mac = zd_netdev_mac(netdev);
+ struct zd_chip *chip = &mac->chip;
+ int r;
+
+ tasklet_enable(&mac->rx_tasklet);
+
+ r = zd_chip_enable_int(chip);
+ if (r < 0)
+ goto out;
+
+ r = zd_chip_set_basic_rates(chip, CR_RATES_80211B | CR_RATES_80211G);
+ if (r < 0)
+ goto disable_int;
+ r = reset_mode(mac);
+ if (r)
+ goto disable_int;
+ r = zd_chip_switch_radio_on(chip);
+ if (r < 0)
+ goto disable_int;
+ r = zd_chip_set_channel(chip, mac->requested_channel);
+ if (r < 0)
+ goto disable_radio;
+ r = zd_chip_enable_rx(chip);
+ if (r < 0)
+ goto disable_radio;
+ r = zd_chip_enable_hwint(chip);
+ if (r < 0)
+ goto disable_rx;
+
+ housekeeping_enable(mac);
+ netif_carrier_on(netdev);
+ ieee80211softmac_start(netdev);
+ if(!netif_queue_stopped(netdev))
+ netif_start_queue(netdev);
+ else
+ netif_wake_queue(netdev);
+
+ return 0;
+disable_rx:
+ zd_chip_disable_rx(chip);
+disable_radio:
+ zd_chip_switch_radio_off(chip);
+disable_int:
+ zd_chip_disable_int(chip);
+out:
+ return r;
+}
+
+int zd_mac_stop(struct net_device *netdev)
+{
+ struct zd_mac *mac = zd_netdev_mac(netdev);
+ struct zd_chip *chip = &mac->chip;
+
+ netif_stop_queue(netdev);
+
+ /*
+ * The order here deliberately is a little different from the open()
+ * method, since we need to make sure there is no opportunity for RX
+ * frames to be processed by softmac after we have stopped it.
+ */
+
+ zd_chip_disable_rx(chip);
+ skb_queue_purge(&mac->rx_queue);
+ tasklet_disable(&mac->rx_tasklet);
+ housekeeping_disable(mac);
+ ieee80211softmac_stop(netdev);
+
+ /* Ensure no work items are running or queued from this point */
+ cancel_delayed_work(&mac->set_rts_cts_work);
+ cancel_delayed_work(&mac->set_basic_rates_work);
+ flush_workqueue(zd_workqueue);
+ mac->updating_rts_rate = 0;
+ mac->updating_basic_rates = 0;
+
+ zd_chip_disable_hwint(chip);
+ zd_chip_switch_radio_off(chip);
+ zd_chip_disable_int(chip);
+
+ return 0;
+}
+
+int zd_mac_set_mac_address(struct net_device *netdev, void *p)
+{
+ int r;
+ unsigned long flags;
+ struct sockaddr *addr = p;
+ struct zd_mac *mac = zd_netdev_mac(netdev);
+ struct zd_chip *chip = &mac->chip;
+
+ if (!is_valid_ether_addr(addr->sa_data))
+ return -EADDRNOTAVAIL;
+
+ dev_dbg_f(zd_mac_dev(mac),
+ "Setting MAC to " MAC_FMT "\n", MAC_ARG(addr->sa_data));
+
+ r = zd_write_mac_addr(chip, addr->sa_data);
+ if (r)
+ return r;
+
+ spin_lock_irqsave(&mac->lock, flags);
+ memcpy(netdev->dev_addr, addr->sa_data, ETH_ALEN);
+ spin_unlock_irqrestore(&mac->lock, flags);
+
+ return 0;
+}
+
+static void set_multicast_hash_handler(struct work_struct *work)
+{
+ struct zd_mac *mac = container_of(work, struct zd_mac,
+ set_multicast_hash_work);
+ struct zd_mc_hash hash;
+
+ spin_lock_irq(&mac->lock);
+ hash = mac->multicast_hash;
+ spin_unlock_irq(&mac->lock);
+
+ zd_chip_set_multicast_hash(&mac->chip, &hash);
+}
+
+void zd_mac_set_multicast_list(struct net_device *dev)
+{
+ struct zd_mc_hash hash;
+ struct zd_mac *mac = zd_netdev_mac(dev);
+ struct dev_mc_list *mc;
+ unsigned long flags;
+
+ if (dev->flags & (IFF_PROMISC|IFF_ALLMULTI)) {
+ zd_mc_add_all(&hash);
+ } else {
+ zd_mc_clear(&hash);
+ for (mc = dev->mc_list; mc; mc = mc->next) {
+ dev_dbg_f(zd_mac_dev(mac), "mc addr " MAC_FMT "\n",
+ MAC_ARG(mc->dmi_addr));
+ zd_mc_add_addr(&hash, mc->dmi_addr);
+ }
+ }
+
+ spin_lock_irqsave(&mac->lock, flags);
+ mac->multicast_hash = hash;
+ spin_unlock_irqrestore(&mac->lock, flags);
+ queue_work(zd_workqueue, &mac->set_multicast_hash_work);
+}
+
+int zd_mac_set_regdomain(struct zd_mac *mac, u8 regdomain)
+{
+ int r;
+ u8 channel;
+
+ ZD_ASSERT(!irqs_disabled());
+ spin_lock_irq(&mac->lock);
+ if (regdomain == 0) {
+ regdomain = mac->default_regdomain;
+ }
+ if (!zd_regdomain_supported(regdomain)) {
+ spin_unlock_irq(&mac->lock);
+ return -EINVAL;
+ }
+ mac->regdomain = regdomain;
+ channel = mac->requested_channel;
+ spin_unlock_irq(&mac->lock);
+
+ r = zd_geo_init(zd_mac_to_ieee80211(mac), regdomain);
+ if (r)
+ return r;
+ if (!zd_regdomain_supports_channel(regdomain, channel)) {
+ r = reset_channel(mac);
+ if (r)
+ return r;
+ }
+
+ return 0;
+}
+
+u8 zd_mac_get_regdomain(struct zd_mac *mac)
+{
+ unsigned long flags;
+ u8 regdomain;
+
+ spin_lock_irqsave(&mac->lock, flags);
+ regdomain = mac->regdomain;
+ spin_unlock_irqrestore(&mac->lock, flags);
+ return regdomain;
+}
+
+/* Fallback to lowest rate, if rate is unknown. */
+static u8 rate_to_zd_rate(u8 rate)
+{
+ switch (rate) {
+ case IEEE80211_CCK_RATE_2MB:
+ return ZD_CCK_RATE_2M;
+ case IEEE80211_CCK_RATE_5MB:
+ return ZD_CCK_RATE_5_5M;
+ case IEEE80211_CCK_RATE_11MB:
+ return ZD_CCK_RATE_11M;
+ case IEEE80211_OFDM_RATE_6MB:
+ return ZD_OFDM_RATE_6M;
+ case IEEE80211_OFDM_RATE_9MB:
+ return ZD_OFDM_RATE_9M;
+ case IEEE80211_OFDM_RATE_12MB:
+ return ZD_OFDM_RATE_12M;
+ case IEEE80211_OFDM_RATE_18MB:
+ return ZD_OFDM_RATE_18M;
+ case IEEE80211_OFDM_RATE_24MB:
+ return ZD_OFDM_RATE_24M;
+ case IEEE80211_OFDM_RATE_36MB:
+ return ZD_OFDM_RATE_36M;
+ case IEEE80211_OFDM_RATE_48MB:
+ return ZD_OFDM_RATE_48M;
+ case IEEE80211_OFDM_RATE_54MB:
+ return ZD_OFDM_RATE_54M;
+ }
+ return ZD_CCK_RATE_1M;
+}
+
+static u16 rate_to_cr_rate(u8 rate)
+{
+ switch (rate) {
+ case IEEE80211_CCK_RATE_2MB:
+ return CR_RATE_1M;
+ case IEEE80211_CCK_RATE_5MB:
+ return CR_RATE_5_5M;
+ case IEEE80211_CCK_RATE_11MB:
+ return CR_RATE_11M;
+ case IEEE80211_OFDM_RATE_6MB:
+ return CR_RATE_6M;
+ case IEEE80211_OFDM_RATE_9MB:
+ return CR_RATE_9M;
+ case IEEE80211_OFDM_RATE_12MB:
+ return CR_RATE_12M;
+ case IEEE80211_OFDM_RATE_18MB:
+ return CR_RATE_18M;
+ case IEEE80211_OFDM_RATE_24MB:
+ return CR_RATE_24M;
+ case IEEE80211_OFDM_RATE_36MB:
+ return CR_RATE_36M;
+ case IEEE80211_OFDM_RATE_48MB:
+ return CR_RATE_48M;
+ case IEEE80211_OFDM_RATE_54MB:
+ return CR_RATE_54M;
+ }
+ return CR_RATE_1M;
+}
+
+static void try_enable_tx(struct zd_mac *mac)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&mac->lock, flags);
+ if (mac->updating_rts_rate == 0 && mac->updating_basic_rates == 0)
+ netif_wake_queue(mac->netdev);
+ spin_unlock_irqrestore(&mac->lock, flags);
+}
+
+static void set_rts_cts_work(struct work_struct *work)
+{
+ struct zd_mac *mac =
+ container_of(work, struct zd_mac, set_rts_cts_work.work);
+ unsigned long flags;
+ u8 rts_rate;
+ unsigned int short_preamble;
+
+ mutex_lock(&mac->chip.mutex);
+
+ spin_lock_irqsave(&mac->lock, flags);
+ mac->updating_rts_rate = 0;
+ rts_rate = mac->rts_rate;
+ short_preamble = mac->short_preamble;
+ spin_unlock_irqrestore(&mac->lock, flags);
+
+ zd_chip_set_rts_cts_rate_locked(&mac->chip, rts_rate, short_preamble);
+ mutex_unlock(&mac->chip.mutex);
+
+ try_enable_tx(mac);
+}
+
+static void set_basic_rates_work(struct work_struct *work)
+{
+ struct zd_mac *mac =
+ container_of(work, struct zd_mac, set_basic_rates_work.work);
+ unsigned long flags;
+ u16 basic_rates;
+
+ mutex_lock(&mac->chip.mutex);
+
+ spin_lock_irqsave(&mac->lock, flags);
+ mac->updating_basic_rates = 0;
+ basic_rates = mac->basic_rates;
+ spin_unlock_irqrestore(&mac->lock, flags);
+
+ zd_chip_set_basic_rates_locked(&mac->chip, basic_rates);
+ mutex_unlock(&mac->chip.mutex);
+
+ try_enable_tx(mac);
+}
+
+static void bssinfo_change(struct net_device *netdev, u32 changes)
+{
+ struct zd_mac *mac = zd_netdev_mac(netdev);
+ struct ieee80211softmac_device *softmac = ieee80211_priv(netdev);
+ struct ieee80211softmac_bss_info *bssinfo = &softmac->bssinfo;
+ int need_set_rts_cts = 0;
+ int need_set_rates = 0;
+ u16 basic_rates;
+ unsigned long flags;
+
+ dev_dbg_f(zd_mac_dev(mac), "changes: %x\n", changes);
+
+ if (changes & IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE) {
+ spin_lock_irqsave(&mac->lock, flags);
+ mac->short_preamble = bssinfo->short_preamble;
+ spin_unlock_irqrestore(&mac->lock, flags);
+ need_set_rts_cts = 1;
+ }
+
+ if (changes & IEEE80211SOFTMAC_BSSINFOCHG_RATES) {
+ /* Set RTS rate to highest available basic rate */
+ u8 hi_rate = ieee80211softmac_highest_supported_rate(softmac,
+ &bssinfo->supported_rates, 1);
+ hi_rate = rate_to_zd_rate(hi_rate);
+
+ spin_lock_irqsave(&mac->lock, flags);
+ if (hi_rate != mac->rts_rate) {
+ mac->rts_rate = hi_rate;
+ need_set_rts_cts = 1;
+ }
+ spin_unlock_irqrestore(&mac->lock, flags);
+
+ /* Set basic rates */
+ need_set_rates = 1;
+ if (bssinfo->supported_rates.count == 0) {
+ /* Allow the device to be flexible */
+ basic_rates = CR_RATES_80211B | CR_RATES_80211G;
+ } else {
+ int i = 0;
+ basic_rates = 0;
+
+ for (i = 0; i < bssinfo->supported_rates.count; i++) {
+ u16 rate = bssinfo->supported_rates.rates[i];
+ if ((rate & IEEE80211_BASIC_RATE_MASK) == 0)
+ continue;
+
+ rate &= ~IEEE80211_BASIC_RATE_MASK;
+ basic_rates |= rate_to_cr_rate(rate);
+ }
+ }
+ spin_lock_irqsave(&mac->lock, flags);
+ mac->basic_rates = basic_rates;
+ spin_unlock_irqrestore(&mac->lock, flags);
+ }
+
+ /* Schedule any changes we made above */
+
+ spin_lock_irqsave(&mac->lock, flags);
+ if (need_set_rts_cts && !mac->updating_rts_rate) {
+ mac->updating_rts_rate = 1;
+ netif_stop_queue(mac->netdev);
+ queue_delayed_work(zd_workqueue, &mac->set_rts_cts_work, 0);
+ }
+ if (need_set_rates && !mac->updating_basic_rates) {
+ mac->updating_basic_rates = 1;
+ netif_stop_queue(mac->netdev);
+ queue_delayed_work(zd_workqueue, &mac->set_basic_rates_work,
+ 0);
+ }
+ spin_unlock_irqrestore(&mac->lock, flags);
+}
+
+static void set_channel(struct net_device *netdev, u8 channel)
+{
+ struct zd_mac *mac = zd_netdev_mac(netdev);
+
+ dev_dbg_f(zd_mac_dev(mac), "channel %d\n", channel);
+
+ zd_chip_set_channel(&mac->chip, channel);
+}
+
+int zd_mac_request_channel(struct zd_mac *mac, u8 channel)
+{
+ unsigned long lock_flags;
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
+
+ if (ieee->iw_mode == IW_MODE_INFRA)
+ return -EPERM;
+
+ spin_lock_irqsave(&mac->lock, lock_flags);
+ if (!zd_regdomain_supports_channel(mac->regdomain, channel)) {
+ spin_unlock_irqrestore(&mac->lock, lock_flags);
+ return -EINVAL;
+ }
+ mac->requested_channel = channel;
+ spin_unlock_irqrestore(&mac->lock, lock_flags);
+ if (netif_running(mac->netdev))
+ return zd_chip_set_channel(&mac->chip, channel);
+ else
+ return 0;
+}
+
+u8 zd_mac_get_channel(struct zd_mac *mac)
+{
+ u8 channel = zd_chip_get_channel(&mac->chip);
+
+ dev_dbg_f(zd_mac_dev(mac), "channel %u\n", channel);
+ return channel;
+}
+
+/* If wrong rate is given, we are falling back to the slowest rate: 1MBit/s */
+static u8 zd_rate_typed(u8 zd_rate)
+{
+ static const u8 typed_rates[16] = {
+ [ZD_CCK_RATE_1M] = ZD_CS_CCK|ZD_CCK_RATE_1M,
+ [ZD_CCK_RATE_2M] = ZD_CS_CCK|ZD_CCK_RATE_2M,
+ [ZD_CCK_RATE_5_5M] = ZD_CS_CCK|ZD_CCK_RATE_5_5M,
+ [ZD_CCK_RATE_11M] = ZD_CS_CCK|ZD_CCK_RATE_11M,
+ [ZD_OFDM_RATE_6M] = ZD_CS_OFDM|ZD_OFDM_RATE_6M,
+ [ZD_OFDM_RATE_9M] = ZD_CS_OFDM|ZD_OFDM_RATE_9M,
+ [ZD_OFDM_RATE_12M] = ZD_CS_OFDM|ZD_OFDM_RATE_12M,
+ [ZD_OFDM_RATE_18M] = ZD_CS_OFDM|ZD_OFDM_RATE_18M,
+ [ZD_OFDM_RATE_24M] = ZD_CS_OFDM|ZD_OFDM_RATE_24M,
+ [ZD_OFDM_RATE_36M] = ZD_CS_OFDM|ZD_OFDM_RATE_36M,
+ [ZD_OFDM_RATE_48M] = ZD_CS_OFDM|ZD_OFDM_RATE_48M,
+ [ZD_OFDM_RATE_54M] = ZD_CS_OFDM|ZD_OFDM_RATE_54M,
+ };
+
+ ZD_ASSERT(ZD_CS_RATE_MASK == 0x0f);
+ return typed_rates[zd_rate & ZD_CS_RATE_MASK];
+}
+
+int zd_mac_set_mode(struct zd_mac *mac, u32 mode)
+{
+ struct ieee80211_device *ieee;
+
+ switch (mode) {
+ case IW_MODE_AUTO:
+ case IW_MODE_ADHOC:
+ case IW_MODE_INFRA:
+ mac->netdev->type = ARPHRD_ETHER;
+ break;
+ case IW_MODE_MONITOR:
+ mac->netdev->type = ARPHRD_IEEE80211_RADIOTAP;
+ break;
+ default:
+ dev_dbg_f(zd_mac_dev(mac), "wrong mode %u\n", mode);
+ return -EINVAL;
+ }
+
+ ieee = zd_mac_to_ieee80211(mac);
+ ZD_ASSERT(!irqs_disabled());
+ spin_lock_irq(&ieee->lock);
+ ieee->iw_mode = mode;
+ spin_unlock_irq(&ieee->lock);
+
+ if (netif_running(mac->netdev))
+ return reset_mode(mac);
+
+ return 0;
+}
+
+int zd_mac_get_mode(struct zd_mac *mac, u32 *mode)
+{
+ unsigned long flags;
+ struct ieee80211_device *ieee;
+
+ ieee = zd_mac_to_ieee80211(mac);
+ spin_lock_irqsave(&ieee->lock, flags);
+ *mode = ieee->iw_mode;
+ spin_unlock_irqrestore(&ieee->lock, flags);
+ return 0;
+}
+
+int zd_mac_get_range(struct zd_mac *mac, struct iw_range *range)
+{
+ int i;
+ const struct channel_range *channel_range;
+ u8 regdomain;
+
+ memset(range, 0, sizeof(*range));
+
+ /* FIXME: Not so important and depends on the mode. For 802.11g
+ * usually this value is used. It seems to be that Bit/s number is
+ * given here.
+ */
+ range->throughput = 27 * 1000 * 1000;
+
+ range->max_qual.qual = 100;
+ range->max_qual.level = 100;
+
+ /* FIXME: Needs still to be tuned. */
+ range->avg_qual.qual = 71;
+ range->avg_qual.level = 80;
+
+ /* FIXME: depends on standard? */
+ range->min_rts = 256;
+ range->max_rts = 2346;
+
+ range->min_frag = MIN_FRAG_THRESHOLD;
+ range->max_frag = MAX_FRAG_THRESHOLD;
+
+ range->max_encoding_tokens = WEP_KEYS;
+ range->num_encoding_sizes = 2;
+ range->encoding_size[0] = 5;
+ range->encoding_size[1] = WEP_KEY_LEN;
+
+ range->we_version_compiled = WIRELESS_EXT;
+ range->we_version_source = 20;
+
+ range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
+ IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
+
+ ZD_ASSERT(!irqs_disabled());
+ spin_lock_irq(&mac->lock);
+ regdomain = mac->regdomain;
+ spin_unlock_irq(&mac->lock);
+ channel_range = zd_channel_range(regdomain);
+
+ range->num_channels = channel_range->end - channel_range->start;
+ range->old_num_channels = range->num_channels;
+ range->num_frequency = range->num_channels;
+ range->old_num_frequency = range->num_frequency;
+
+ for (i = 0; i < range->num_frequency; i++) {
+ struct iw_freq *freq = &range->freq[i];
+ freq->i = channel_range->start + i;
+ zd_channel_to_freq(freq, freq->i);
+ }
+
+ return 0;
+}
+
+static int zd_calc_tx_length_us(u8 *service, u8 zd_rate, u16 tx_length)
+{
+ static const u8 rate_divisor[] = {
+ [ZD_CCK_RATE_1M] = 1,
+ [ZD_CCK_RATE_2M] = 2,
+ [ZD_CCK_RATE_5_5M] = 11, /* bits must be doubled */
+ [ZD_CCK_RATE_11M] = 11,
+ [ZD_OFDM_RATE_6M] = 6,
+ [ZD_OFDM_RATE_9M] = 9,
+ [ZD_OFDM_RATE_12M] = 12,
+ [ZD_OFDM_RATE_18M] = 18,
+ [ZD_OFDM_RATE_24M] = 24,
+ [ZD_OFDM_RATE_36M] = 36,
+ [ZD_OFDM_RATE_48M] = 48,
+ [ZD_OFDM_RATE_54M] = 54,
+ };
+
+ u32 bits = (u32)tx_length * 8;
+ u32 divisor;
+
+ divisor = rate_divisor[zd_rate];
+ if (divisor == 0)
+ return -EINVAL;
+
+ switch (zd_rate) {
+ case ZD_CCK_RATE_5_5M:
+ bits = (2*bits) + 10; /* round up to the next integer */
+ break;
+ case ZD_CCK_RATE_11M:
+ if (service) {
+ u32 t = bits % 11;
+ *service &= ~ZD_PLCP_SERVICE_LENGTH_EXTENSION;
+ if (0 < t && t <= 3) {
+ *service |= ZD_PLCP_SERVICE_LENGTH_EXTENSION;
+ }
+ }
+ bits += 10; /* round up to the next integer */
+ break;
+ }
+
+ return bits/divisor;
+}
+
+enum {
+ R2M_SHORT_PREAMBLE = 0x01,
+ R2M_11A = 0x02,
+};
+
+static u8 zd_rate_to_modulation(u8 zd_rate, int flags)
+{
+ u8 modulation;
+
+ modulation = zd_rate_typed(zd_rate);
+ if (flags & R2M_SHORT_PREAMBLE) {
+ switch (ZD_CS_RATE(modulation)) {
+ case ZD_CCK_RATE_2M:
+ case ZD_CCK_RATE_5_5M:
+ case ZD_CCK_RATE_11M:
+ modulation |= ZD_CS_CCK_PREA_SHORT;
+ return modulation;
+ }
+ }
+ if (flags & R2M_11A) {
+ if (ZD_CS_TYPE(modulation) == ZD_CS_OFDM)
+ modulation |= ZD_CS_OFDM_MODE_11A;
+ }
+ return modulation;
+}
+
+static void cs_set_modulation(struct zd_mac *mac, struct zd_ctrlset *cs,
+ struct ieee80211_hdr_4addr *hdr)
+{
+ struct ieee80211softmac_device *softmac = ieee80211_priv(mac->netdev);
+ u16 ftype = WLAN_FC_GET_TYPE(le16_to_cpu(hdr->frame_ctl));
+ u8 rate, zd_rate;
+ int is_mgt = (ftype == IEEE80211_FTYPE_MGMT) != 0;
+ int is_multicast = is_multicast_ether_addr(hdr->addr1);
+ int short_preamble = ieee80211softmac_short_preamble_ok(softmac,
+ is_multicast, is_mgt);
+ int flags = 0;
+
+ /* FIXME: 802.11a? */
+ rate = ieee80211softmac_suggest_txrate(softmac, is_multicast, is_mgt);
+
+ if (short_preamble)
+ flags |= R2M_SHORT_PREAMBLE;
+
+ zd_rate = rate_to_zd_rate(rate);
+ cs->modulation = zd_rate_to_modulation(zd_rate, flags);
+}
+
+static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
+ struct ieee80211_hdr_4addr *header)
+{
+ struct ieee80211softmac_device *softmac = ieee80211_priv(mac->netdev);
+ unsigned int tx_length = le16_to_cpu(cs->tx_length);
+ u16 fctl = le16_to_cpu(header->frame_ctl);
+ u16 ftype = WLAN_FC_GET_TYPE(fctl);
+ u16 stype = WLAN_FC_GET_STYPE(fctl);
+
+ /*
+ * CONTROL TODO:
+ * - if backoff needed, enable bit 0
+ * - if burst (backoff not needed) disable bit 0
+ */
+
+ cs->control = 0;
+
+ /* First fragment */
+ if (WLAN_GET_SEQ_FRAG(le16_to_cpu(header->seq_ctl)) == 0)
+ cs->control |= ZD_CS_NEED_RANDOM_BACKOFF;
+
+ /* Multicast */
+ if (is_multicast_ether_addr(header->addr1))
+ cs->control |= ZD_CS_MULTICAST;
+
+ /* PS-POLL */
+ if (stype == IEEE80211_STYPE_PSPOLL)
+ cs->control |= ZD_CS_PS_POLL_FRAME;
+
+ /* Unicast data frames over the threshold should have RTS */
+ if (!is_multicast_ether_addr(header->addr1) &&
+ ftype != IEEE80211_FTYPE_MGMT &&
+ tx_length > zd_netdev_ieee80211(mac->netdev)->rts)
+ cs->control |= ZD_CS_RTS;
+
+ /* Use CTS-to-self protection if required */
+ if (ZD_CS_TYPE(cs->modulation) == ZD_CS_OFDM &&
+ ieee80211softmac_protection_needed(softmac)) {
+ /* FIXME: avoid sending RTS *and* self-CTS, is that correct? */
+ cs->control &= ~ZD_CS_RTS;
+ cs->control |= ZD_CS_SELF_CTS;
+ }
+
+ /* FIXME: Management frame? */
+}
+
+static int fill_ctrlset(struct zd_mac *mac,
+ struct ieee80211_txb *txb,
+ int frag_num)
+{
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
+ int r;
+ struct sk_buff *skb = txb->fragments[frag_num];
+ struct ieee80211_hdr_4addr *hdr =
+ (struct ieee80211_hdr_4addr *) skb->data;
+ unsigned int frag_len = skb->len + IEEE80211_FCS_LEN;
+ unsigned int next_frag_len;
+ unsigned int packet_length;
+ struct zd_ctrlset *cs = (struct zd_ctrlset *)
+ skb_push(skb, sizeof(struct zd_ctrlset));
+
+ if (frag_num+1 < txb->nr_frags) {
+ next_frag_len = txb->fragments[frag_num+1]->len +
+ IEEE80211_FCS_LEN;
+ } else {
+ next_frag_len = 0;
+ }
+ ZD_ASSERT(frag_len <= 0xffff);
+ ZD_ASSERT(next_frag_len <= 0xffff);
+
+ cs_set_modulation(mac, cs, hdr);
+
+ cs->tx_length = cpu_to_le16(frag_len);
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ cs->control = ZD_CS_MULTICAST;
+ else
+ cs_set_control(mac, cs, hdr);
+
+ packet_length = frag_len + sizeof(struct zd_ctrlset) + 10;
+ ZD_ASSERT(packet_length <= 0xffff);
+ /* ZD1211B: Computing the length difference this way, gives us
+ * flexibility to compute the packet length.
+ */
+ cs->packet_length = cpu_to_le16(mac->chip.is_zd1211b ?
+ packet_length - frag_len : packet_length);
+
+ /*
+ * CURRENT LENGTH:
+ * - transmit frame length in microseconds
+ * - seems to be derived from frame length
+ * - see Cal_Us_Service() in zdinlinef.h
+ * - if macp->bTxBurstEnable is enabled, then multiply by 4
+ * - bTxBurstEnable is never set in the vendor driver
+ *
+ * SERVICE:
+ * - "for PLCP configuration"
+ * - always 0 except in some situations at 802.11b 11M
+ * - see line 53 of zdinlinef.h
+ */
+ cs->service = 0;
+ r = zd_calc_tx_length_us(&cs->service, ZD_CS_RATE(cs->modulation),
+ le16_to_cpu(cs->tx_length));
+ if (r < 0)
+ return r;
+ cs->current_length = cpu_to_le16(r);
+
+ if (next_frag_len == 0) {
+ cs->next_frame_length = 0;
+ } else {
+ r = zd_calc_tx_length_us(NULL, ZD_CS_RATE(cs->modulation),
+ next_frag_len);
+ if (r < 0)
+ return r;
+ cs->next_frame_length = cpu_to_le16(r);
+ }
+
+ return 0;
+}
+
+static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri)
+{
+ int i, r;
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
+
+ for (i = 0; i < txb->nr_frags; i++) {
+ struct sk_buff *skb = txb->fragments[i];
+
+ r = fill_ctrlset(mac, txb, i);
+ if (r) {
+ ieee->stats.tx_dropped++;
+ return r;
+ }
+
+ if(ieee->iw_mode == IW_MODE_MONITOR)
+ r = zd_usb_tx_inject(&mac->chip.usb, skb->data, skb->len);
+ else
+ r = zd_usb_tx(&mac->chip.usb, skb->data, skb->len);
+ if (r) {
+ ieee->stats.tx_dropped++;
+ return r;
+ }
+ }
+
+ /* FIXME: shouldn't this be handled by the upper layers? */
+ mac->netdev->trans_start = jiffies;
+
+ ieee80211_txb_free(txb);
+ return 0;
+}
+
+struct zd_rt_hdr {
+ struct ieee80211_radiotap_header rt_hdr;
+ u8 rt_flags;
+ u8 rt_rate;
+ u16 rt_channel;
+ u16 rt_chbitmask;
+ u8 rt_antsignal;
+ u8 rt_antnoise;
+} __attribute__((packed));
+
+static void fill_rt_header(void *buffer, struct zd_mac *mac,
+ const struct ieee80211_rx_stats *stats,
+ const struct rx_status *status)
+{
+ struct zd_rt_hdr *hdr = buffer;
+
+ hdr->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION;
+ hdr->rt_hdr.it_pad = 0;
+ hdr->rt_hdr.it_len = cpu_to_le16(sizeof(struct zd_rt_hdr));
+ hdr->rt_hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) |
+ (1 << IEEE80211_RADIOTAP_CHANNEL) |
+ (1 << IEEE80211_RADIOTAP_RATE) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE));
+
+ hdr->rt_flags = 0;
+ if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
+ hdr->rt_flags |= IEEE80211_RADIOTAP_F_WEP;
+
+ hdr->rt_rate = stats->rate / 5;
+
+ /* FIXME: 802.11a */
+ hdr->rt_channel = cpu_to_le16(ieee80211chan2mhz(
+ _zd_chip_get_channel(&mac->chip)));
+ hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
+ ((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
+ ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
+
+ hdr->rt_antsignal = status->signal_strength;
+ hdr->rt_antnoise = stats->noise;
+}
+
+/* Returns 1 if the data packet is for us and 0 otherwise. */
+static int is_data_packet_for_us(struct ieee80211_device *ieee,
+ struct ieee80211_hdr_4addr *hdr)
+{
+ struct net_device *netdev = ieee->dev;
+ u16 fc = le16_to_cpu(hdr->frame_ctl);
+
+ ZD_ASSERT(WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA);
+
+ switch (ieee->iw_mode) {
+ case IW_MODE_ADHOC:
+ if ((fc & (IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS)) != 0 ||
+ compare_ether_addr(hdr->addr3, ieee->bssid) != 0)
+ return 0;
+ break;
+ case IW_MODE_AUTO:
+ case IW_MODE_INFRA:
+ if ((fc & (IEEE80211_FCTL_TODS|IEEE80211_FCTL_FROMDS)) !=
+ IEEE80211_FCTL_FROMDS ||
+ compare_ether_addr(hdr->addr2, ieee->bssid) != 0)
+ return 0;
+ break;
+ default:
+ ZD_ASSERT(ieee->iw_mode != IW_MODE_MONITOR);
+ return 0;
+ }
+
+ return compare_ether_addr(hdr->addr1, netdev->dev_addr) == 0 ||
+ (is_multicast_ether_addr(hdr->addr1) &&
+ compare_ether_addr(hdr->addr3, netdev->dev_addr) != 0) ||
+ (netdev->flags & IFF_PROMISC);
+}
+
+/* Filters received packets. The function returns 1 if the packet should be
+ * forwarded to ieee80211_rx(). If the packet should be ignored the function
+ * returns 0. If an invalid packet is found the function returns -EINVAL.
+ *
+ * The function calls ieee80211_rx_mgt() directly.
+ *
+ * It has been based on ieee80211_rx_any.
+ */
+static int filter_rx(struct ieee80211_device *ieee,
+ const u8 *buffer, unsigned int length,
+ struct ieee80211_rx_stats *stats)
+{
+ struct ieee80211_hdr_4addr *hdr;
+ u16 fc;
+
+ if (ieee->iw_mode == IW_MODE_MONITOR)
+ return 1;
+
+ hdr = (struct ieee80211_hdr_4addr *)buffer;
+ fc = le16_to_cpu(hdr->frame_ctl);
+ if ((fc & IEEE80211_FCTL_VERS) != 0)
+ return -EINVAL;
+
+ switch (WLAN_FC_GET_TYPE(fc)) {
+ case IEEE80211_FTYPE_MGMT:
+ if (length < sizeof(struct ieee80211_hdr_3addr))
+ return -EINVAL;
+ ieee80211_rx_mgt(ieee, hdr, stats);
+ return 0;
+ case IEEE80211_FTYPE_CTL:
+ return 0;
+ case IEEE80211_FTYPE_DATA:
+ /* Ignore invalid short buffers */
+ if (length < sizeof(struct ieee80211_hdr_3addr))
+ return -EINVAL;
+ return is_data_packet_for_us(ieee, hdr);
+ }
+
+ return -EINVAL;
+}
+
+static void update_qual_rssi(struct zd_mac *mac,
+ const u8 *buffer, unsigned int length,
+ u8 qual_percent, u8 rssi_percent)
+{
+ unsigned long flags;
+ struct ieee80211_hdr_3addr *hdr;
+ int i;
+
+ hdr = (struct ieee80211_hdr_3addr *)buffer;
+ if (length < offsetof(struct ieee80211_hdr_3addr, addr3))
+ return;
+ if (compare_ether_addr(hdr->addr2, zd_mac_to_ieee80211(mac)->bssid) != 0)
+ return;
+
+ spin_lock_irqsave(&mac->lock, flags);
+ i = mac->stats_count % ZD_MAC_STATS_BUFFER_SIZE;
+ mac->qual_buffer[i] = qual_percent;
+ mac->rssi_buffer[i] = rssi_percent;
+ mac->stats_count++;
+ spin_unlock_irqrestore(&mac->lock, flags);
+}
+
+static int fill_rx_stats(struct ieee80211_rx_stats *stats,
+ const struct rx_status **pstatus,
+ struct zd_mac *mac,
+ const u8 *buffer, unsigned int length)
+{
+ const struct rx_status *status;
+
+ *pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
+ if (status->frame_status & ZD_RX_ERROR
+ || status->frame_status & ~0x21) {
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
+ ieee->stats.rx_errors++;
+ if (status->frame_status & ZD_RX_TIMEOUT_ERROR)
+ ieee->stats.rx_missed_errors++;
+ else if (status->frame_status & ZD_RX_FIFO_OVERRUN_ERROR)
+ ieee->stats.rx_fifo_errors++;
+ else if (status->frame_status & ZD_RX_DECRYPTION_ERROR)
+ ieee->ieee_stats.rx_discards_undecryptable++;
+ else if (status->frame_status & ZD_RX_CRC32_ERROR) {
+ ieee->stats.rx_crc_errors++;
+ ieee->ieee_stats.rx_fcs_errors++;
+ }
+ else if (status->frame_status & ZD_RX_CRC16_ERROR)
+ ieee->stats.rx_crc_errors++;
+ return -EINVAL;
+ }
+
+ memset(stats, 0, sizeof(struct ieee80211_rx_stats));
+ stats->len = length - (ZD_PLCP_HEADER_SIZE + IEEE80211_FCS_LEN +
+ + sizeof(struct rx_status));
+ /* FIXME: 802.11a */
+ stats->freq = IEEE80211_24GHZ_BAND;
+ stats->received_channel = _zd_chip_get_channel(&mac->chip);
+ stats->rssi = zd_rx_strength_percent(status->signal_strength);
+ stats->signal = zd_rx_qual_percent(buffer,
+ length - sizeof(struct rx_status),
+ status);
+ stats->mask = IEEE80211_STATMASK_RSSI | IEEE80211_STATMASK_SIGNAL;
+ stats->rate = zd_rx_rate(buffer, status);
+ if (stats->rate)
+ stats->mask |= IEEE80211_STATMASK_RATE;
+
+ return 0;
+}
+
+static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
+{
+ int r;
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
+ struct ieee80211_rx_stats stats;
+ const struct rx_status *status;
+
+ if (skb->len < ZD_PLCP_HEADER_SIZE + IEEE80211_1ADDR_LEN +
+ IEEE80211_FCS_LEN + sizeof(struct rx_status))
+ {
+ ieee->stats.rx_errors++;
+ ieee->stats.rx_length_errors++;
+ goto free_skb;
+ }
+
+ r = fill_rx_stats(&stats, &status, mac, skb->data, skb->len);
+ if (r) {
+ /* Only packets with rx errors are included here.
+ * The error stats have already been set in fill_rx_stats.
+ */
+ goto free_skb;
+ }
+
+ __skb_pull(skb, ZD_PLCP_HEADER_SIZE);
+ __skb_trim(skb, skb->len -
+ (IEEE80211_FCS_LEN + sizeof(struct rx_status)));
+
+ update_qual_rssi(mac, skb->data, skb->len, stats.signal,
+ status->signal_strength);
+
+ r = filter_rx(ieee, skb->data, skb->len, &stats);
+ if (r <= 0) {
+ if (r < 0) {
+ ieee->stats.rx_errors++;
+ dev_dbg_f(zd_mac_dev(mac), "Error in packet.\n");
+ }
+ goto free_skb;
+ }
+
+ if (ieee->iw_mode == IW_MODE_MONITOR)
+ fill_rt_header(skb_push(skb, sizeof(struct zd_rt_hdr)), mac,
+ &stats, status);
+
+ r = ieee80211_rx(ieee, skb, &stats);
+ if (r)
+ return;
+free_skb:
+ /* We are always in a soft irq. */
+ dev_kfree_skb(skb);
+}
+
+static void do_rx(unsigned long mac_ptr)
+{
+ struct zd_mac *mac = (struct zd_mac *)mac_ptr;
+ struct sk_buff *skb;
+
+ while ((skb = skb_dequeue(&mac->rx_queue)) != NULL)
+ zd_mac_rx(mac, skb);
+}
+
+int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
+{
+ struct sk_buff *skb;
+
+ skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length);
+ if (!skb) {
+ struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
+ dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
+ ieee->stats.rx_dropped++;
+ return -ENOMEM;
+ }
+ skb_reserve(skb, sizeof(struct zd_rt_hdr));
+ memcpy(__skb_put(skb, length), buffer, length);
+ skb_queue_tail(&mac->rx_queue, skb);
+ tasklet_schedule(&mac->rx_tasklet);
+ return 0;
+}
+
+static int netdev_tx(struct ieee80211_txb *txb, struct net_device *netdev,
+ int pri)
+{
+ return zd_mac_tx(zd_netdev_mac(netdev), txb, pri);
+}
+
+static void set_security(struct net_device *netdev,
+ struct ieee80211_security *sec)
+{
+ struct ieee80211_device *ieee = zd_netdev_ieee80211(netdev);
+ struct ieee80211_security *secinfo = &ieee->sec;
+ int keyidx;
+
+ dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev)), "\n");
+
+ for (keyidx = 0; keyidx<WEP_KEYS; keyidx++)
+ if (sec->flags & (1<<keyidx)) {
+ secinfo->encode_alg[keyidx] = sec->encode_alg[keyidx];
+ secinfo->key_sizes[keyidx] = sec->key_sizes[keyidx];
+ memcpy(secinfo->keys[keyidx], sec->keys[keyidx],
+ SCM_KEY_LEN);
+ }
+
+ if (sec->flags & SEC_ACTIVE_KEY) {
+ secinfo->active_key = sec->active_key;
+ dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev)),
+ " .active_key = %d\n", sec->active_key);
+ }
+ if (sec->flags & SEC_UNICAST_GROUP) {
+ secinfo->unicast_uses_group = sec->unicast_uses_group;
+ dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev)),
+ " .unicast_uses_group = %d\n",
+ sec->unicast_uses_group);
+ }
+ if (sec->flags & SEC_LEVEL) {
+ secinfo->level = sec->level;
+ dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev)),
+ " .level = %d\n", sec->level);
+ }
+ if (sec->flags & SEC_ENABLED) {
+ secinfo->enabled = sec->enabled;
+ dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev)),
+ " .enabled = %d\n", sec->enabled);
+ }
+ if (sec->flags & SEC_ENCRYPT) {
+ secinfo->encrypt = sec->encrypt;
+ dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev)),
+ " .encrypt = %d\n", sec->encrypt);
+ }
+ if (sec->flags & SEC_AUTH_MODE) {
+ secinfo->auth_mode = sec->auth_mode;
+ dev_dbg_f(zd_mac_dev(zd_netdev_mac(netdev)),
+ " .auth_mode = %d\n", sec->auth_mode);
+ }
+}
+
+static void ieee_init(struct ieee80211_device *ieee)
+{
+ ieee->mode = IEEE_B | IEEE_G;
+ ieee->freq_band = IEEE80211_24GHZ_BAND;
+ ieee->modulation = IEEE80211_OFDM_MODULATION | IEEE80211_CCK_MODULATION;
+ ieee->tx_headroom = sizeof(struct zd_ctrlset);
+ ieee->set_security = set_security;
+ ieee->hard_start_xmit = netdev_tx;
+
+ /* Software encryption/decryption for now */
+ ieee->host_build_iv = 0;
+ ieee->host_encrypt = 1;
+ ieee->host_decrypt = 1;
+
+ /* FIXME: default to managed mode, until ieee80211 and zd1211rw can
+ * correctly support AUTO */
+ ieee->iw_mode = IW_MODE_INFRA;
+}
+
+static void softmac_init(struct ieee80211softmac_device *sm)
+{
+ sm->set_channel = set_channel;
+ sm->bssinfo_change = bssinfo_change;
+}
+
+struct iw_statistics *zd_mac_get_wireless_stats(struct net_device *ndev)
+{
+ struct zd_mac *mac = zd_netdev_mac(ndev);
+ struct iw_statistics *iw_stats = &mac->iw_stats;
+ unsigned int i, count, qual_total, rssi_total;
+
+ memset(iw_stats, 0, sizeof(struct iw_statistics));
+ /* We are not setting the status, because ieee->state is not updated
+ * at all and this driver doesn't track authentication state.
+ */
+ spin_lock_irq(&mac->lock);
+ count = mac->stats_count < ZD_MAC_STATS_BUFFER_SIZE ?
+ mac->stats_count : ZD_MAC_STATS_BUFFER_SIZE;
+ qual_total = rssi_total = 0;
+ for (i = 0; i < count; i++) {
+ qual_total += mac->qual_buffer[i];
+ rssi_total += mac->rssi_buffer[i];
+ }
+ spin_unlock_irq(&mac->lock);
+ iw_stats->qual.updated = IW_QUAL_NOISE_INVALID;
+ if (count > 0) {
+ iw_stats->qual.qual = qual_total / count;
+ iw_stats->qual.level = rssi_total / count;
+ iw_stats->qual.updated |=
+ IW_QUAL_QUAL_UPDATED|IW_QUAL_LEVEL_UPDATED;
+ } else {
+ iw_stats->qual.updated |=
+ IW_QUAL_QUAL_INVALID|IW_QUAL_LEVEL_INVALID;
+ }
+ /* TODO: update counter */
+ return iw_stats;
+}
+
+#define LINK_LED_WORK_DELAY HZ
+
+static void link_led_handler(struct work_struct *work)
+{
+ struct zd_mac *mac =
+ container_of(work, struct zd_mac, housekeeping.link_led_work.work);
+ struct zd_chip *chip = &mac->chip;
+ struct ieee80211softmac_device *sm = ieee80211_priv(mac->netdev);
+ int is_associated;
+ int r;
+
+ spin_lock_irq(&mac->lock);
+ is_associated = sm->associnfo.associated != 0;
+ spin_unlock_irq(&mac->lock);
+
+ r = zd_chip_control_leds(chip,
+ is_associated ? LED_ASSOCIATED : LED_SCANNING);
+ if (r)
+ dev_err(zd_mac_dev(mac), "zd_chip_control_leds error %d\n", r);
+
+ queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work,
+ LINK_LED_WORK_DELAY);
+}
+
+static void housekeeping_init(struct zd_mac *mac)
+{
+ INIT_DELAYED_WORK(&mac->housekeeping.link_led_work, link_led_handler);
+}
+
+static void housekeeping_enable(struct zd_mac *mac)
+{
+ dev_dbg_f(zd_mac_dev(mac), "\n");
+ queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work,
+ 0);
+}
+
+static void housekeeping_disable(struct zd_mac *mac)
+{
+ dev_dbg_f(zd_mac_dev(mac), "\n");
+ cancel_rearming_delayed_workqueue(zd_workqueue,
+ &mac->housekeeping.link_led_work);
+ zd_chip_control_leds(&mac->chip, LED_OFF);
+}
diff -Naur linux-2.6.22_orig/drivers/net/wireless/zd1211rw/zd_usb.c linux-2.6.22/drivers/net/wireless/zd1211rw/zd_usb.c
--- linux-2.6.22_orig/drivers/net/wireless/zd1211rw/zd_usb.c 2007-08-09 15:37:14.000000000 +0200
+++ linux-2.6.22/drivers/net/wireless/zd1211rw/zd_usb.c 2007-08-23 22:26:08.000000000 +0200
@@ -781,6 +781,46 @@
return r;
}
+/* Puts the frame on the USB endpoint. It doesn't wait for
+ * completion. The frame must contain the control set.
+ */
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length)
+{
+ int r;
+ struct usb_device *udev = zd_usb_to_usbdev(usb);
+ struct urb *urb;
+ void *buffer;
+
+ urb = usb_alloc_urb(0, GFP_ATOMIC);
+ if (!urb) {
+ r = -ENOMEM;
+ goto out;
+ }
+
+ buffer = usb_buffer_alloc(zd_usb_to_usbdev(usb), length, GFP_ATOMIC,
+ &urb->transfer_dma);
+ if (!buffer) {
+ r = -ENOMEM;
+ goto error_free_urb;
+ }
+ memcpy(buffer, frame, length);
+
+ usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT),
+ buffer, length, tx_urb_complete, NULL);
+
+ r = usb_submit_urb(urb, GFP_ATOMIC);
+ if (r)
+ goto error;
+ return 0;
+error:
+ usb_buffer_free(zd_usb_to_usbdev(usb), length, buffer,
+ urb->transfer_dma);
+error_free_urb:
+ usb_free_urb(urb);
+out:
+ return r;
+}
+
static inline void init_usb_interrupt(struct zd_usb *usb)
{
struct zd_usb_interrupt *intr = &usb->intr;
diff -Naur linux-2.6.22_orig/drivers/net/wireless/zd1211rw/zd_usb.h linux-2.6.22/drivers/net/wireless/zd1211rw/zd_usb.h
--- linux-2.6.22_orig/drivers/net/wireless/zd1211rw/zd_usb.h 2007-08-09 15:37:14.000000000 +0200
+++ linux-2.6.22/drivers/net/wireless/zd1211rw/zd_usb.h 2007-08-23 22:26:08.000000000 +0200
@@ -221,6 +221,7 @@
void zd_usb_disable_rx(struct zd_usb *usb);
int zd_usb_tx(struct zd_usb *usb, const u8 *frame, unsigned int length);
+int zd_usb_tx_inject(struct zd_usb *usb, const u8 *frame, unsigned int length);
int zd_usb_ioread16v(struct zd_usb *usb, u16 *values,
const zd_addr_t *addresses, unsigned int count); |