nexmon – Rev 1
?pathlinks?
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);
Generated by GNU Enscript 1.6.5.90.