Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
e6874245
Commit
e6874245
authored
Jul 19, 2003
by
Javier Achirica
Committed by
Jeff Garzik
Jul 19, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[wireless airo] Make locking "per thread" so it's fully preemptive.
parent
1bbb8796
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
103 deletions
+98
-103
drivers/net/wireless/airo.c
drivers/net/wireless/airo.c
+98
-103
No files found.
drivers/net/wireless/airo.c
View file @
e6874245
...
@@ -952,8 +952,8 @@ static int get_dec_u16( char *buffer, int *start, int limit );
...
@@ -952,8 +952,8 @@ static int get_dec_u16( char *buffer, int *start, int limit );
static
void
OUT4500
(
struct
airo_info
*
,
u16
register
,
u16
value
);
static
void
OUT4500
(
struct
airo_info
*
,
u16
register
,
u16
value
);
static
unsigned
short
IN4500
(
struct
airo_info
*
,
u16
register
);
static
unsigned
short
IN4500
(
struct
airo_info
*
,
u16
register
);
static
u16
setup_card
(
struct
airo_info
*
,
u8
*
mac
);
static
u16
setup_card
(
struct
airo_info
*
,
u8
*
mac
);
static
int
enable_MAC
(
struct
airo_info
*
ai
,
Resp
*
rsp
);
static
int
enable_MAC
(
struct
airo_info
*
ai
,
Resp
*
rsp
,
int
lock
);
static
void
disable_MAC
(
struct
airo_info
*
ai
);
static
void
disable_MAC
(
struct
airo_info
*
ai
,
int
lock
);
static
void
enable_interrupts
(
struct
airo_info
*
);
static
void
enable_interrupts
(
struct
airo_info
*
);
static
void
disable_interrupts
(
struct
airo_info
*
);
static
void
disable_interrupts
(
struct
airo_info
*
);
static
u16
issuecommand
(
struct
airo_info
*
,
Cmd
*
pCmd
,
Resp
*
pRsp
);
static
u16
issuecommand
(
struct
airo_info
*
,
Cmd
*
pCmd
,
Resp
*
pRsp
);
...
@@ -967,11 +967,11 @@ static int fast_bap_read(struct airo_info*, u16 *pu16Dst, int bytelen,
...
@@ -967,11 +967,11 @@ static int fast_bap_read(struct airo_info*, u16 *pu16Dst, int bytelen,
static
int
bap_write
(
struct
airo_info
*
,
const
u16
*
pu16Src
,
int
bytelen
,
static
int
bap_write
(
struct
airo_info
*
,
const
u16
*
pu16Src
,
int
bytelen
,
int
whichbap
);
int
whichbap
);
static
int
PC4500_accessrid
(
struct
airo_info
*
,
u16
rid
,
u16
accmd
);
static
int
PC4500_accessrid
(
struct
airo_info
*
,
u16
rid
,
u16
accmd
);
static
int
PC4500_readrid
(
struct
airo_info
*
,
u16
rid
,
void
*
pBuf
,
int
len
);
static
int
PC4500_readrid
(
struct
airo_info
*
,
u16
rid
,
void
*
pBuf
,
int
len
,
int
lock
);
static
int
PC4500_writerid
(
struct
airo_info
*
,
u16
rid
,
const
void
static
int
PC4500_writerid
(
struct
airo_info
*
,
u16
rid
,
const
void
*
pBuf
,
int
len
);
*
pBuf
,
int
len
,
int
lock
);
static
int
do_writerid
(
struct
airo_info
*
,
u16
rid
,
const
void
*
rid_data
,
static
int
do_writerid
(
struct
airo_info
*
,
u16
rid
,
const
void
*
rid_data
,
int
len
);
int
len
,
int
dummy
);
static
u16
transmit_allocate
(
struct
airo_info
*
,
int
lenPayload
,
int
raw
);
static
u16
transmit_allocate
(
struct
airo_info
*
,
int
lenPayload
,
int
raw
);
static
int
transmit_802_3_packet
(
struct
airo_info
*
,
int
len
,
char
*
pPacket
);
static
int
transmit_802_3_packet
(
struct
airo_info
*
,
int
len
,
char
*
pPacket
);
static
int
transmit_802_11_packet
(
struct
airo_info
*
,
int
len
,
char
*
pPacket
);
static
int
transmit_802_11_packet
(
struct
airo_info
*
,
int
len
,
char
*
pPacket
);
...
@@ -1015,7 +1015,6 @@ struct airo_info {
...
@@ -1015,7 +1015,6 @@ struct airo_info {
#define FLAG_PROMISC IFF_PROMISC
/* 0x100 - include/linux/if.h */
#define FLAG_PROMISC IFF_PROMISC
/* 0x100 - include/linux/if.h */
#define FLAG_RADIO_OFF 0x02
/* User disabling of MAC */
#define FLAG_RADIO_OFF 0x02
/* User disabling of MAC */
#define FLAG_RADIO_DOWN 0x08
/* ifup/ifdown disabling of MAC */
#define FLAG_RADIO_DOWN 0x08
/* ifup/ifdown disabling of MAC */
#define FLAG_LOCKED 2
/* 0x04 - use as a bit offset */
#define FLAG_FLASHING 0x10
#define FLAG_FLASHING 0x10
#define FLAG_ADHOC 0x01
/* Needed by MIC */
#define FLAG_ADHOC 0x01
/* Needed by MIC */
#define FLAG_MIC_CAPABLE 0x20
#define FLAG_MIC_CAPABLE 0x20
...
@@ -1085,7 +1084,7 @@ static int readBSSListRid(struct airo_info *ai, int first,
...
@@ -1085,7 +1084,7 @@ static int readBSSListRid(struct airo_info *ai, int first,
ai
->
task
=
NULL
;
ai
->
task
=
NULL
;
}
}
rc
=
PC4500_readrid
(
ai
,
first
?
RID_BSSLISTFIRST
:
RID_BSSLISTNEXT
,
rc
=
PC4500_readrid
(
ai
,
first
?
RID_BSSLISTFIRST
:
RID_BSSLISTNEXT
,
list
,
sizeof
(
*
list
));
list
,
sizeof
(
*
list
)
,
1
);
list
->
len
=
le16_to_cpu
(
list
->
len
);
list
->
len
=
le16_to_cpu
(
list
->
len
);
list
->
index
=
le16_to_cpu
(
list
->
index
);
list
->
index
=
le16_to_cpu
(
list
->
index
);
...
@@ -1100,7 +1099,7 @@ static int readBSSListRid(struct airo_info *ai, int first,
...
@@ -1100,7 +1099,7 @@ static int readBSSListRid(struct airo_info *ai, int first,
static
int
readWepKeyRid
(
struct
airo_info
*
ai
,
WepKeyRid
*
wkr
,
int
temp
)
{
static
int
readWepKeyRid
(
struct
airo_info
*
ai
,
WepKeyRid
*
wkr
,
int
temp
)
{
int
rc
=
PC4500_readrid
(
ai
,
temp
?
RID_WEP_TEMP
:
RID_WEP_PERM
,
int
rc
=
PC4500_readrid
(
ai
,
temp
?
RID_WEP_TEMP
:
RID_WEP_PERM
,
wkr
,
sizeof
(
*
wkr
));
wkr
,
sizeof
(
*
wkr
)
,
1
);
wkr
->
len
=
le16_to_cpu
(
wkr
->
len
);
wkr
->
len
=
le16_to_cpu
(
wkr
->
len
);
wkr
->
kindex
=
le16_to_cpu
(
wkr
->
kindex
);
wkr
->
kindex
=
le16_to_cpu
(
wkr
->
kindex
);
...
@@ -1109,17 +1108,17 @@ static int readWepKeyRid(struct airo_info*ai, WepKeyRid *wkr, int temp) {
...
@@ -1109,17 +1108,17 @@ static int readWepKeyRid(struct airo_info*ai, WepKeyRid *wkr, int temp) {
}
}
/* In the writeXXXRid routines we copy the rids so that we don't screwup
/* In the writeXXXRid routines we copy the rids so that we don't screwup
* the originals when we endian them... */
* the originals when we endian them... */
static
int
writeWepKeyRid
(
struct
airo_info
*
ai
,
WepKeyRid
*
pwkr
,
int
perm
)
{
static
int
writeWepKeyRid
(
struct
airo_info
*
ai
,
WepKeyRid
*
pwkr
,
int
perm
,
int
lock
)
{
int
rc
;
int
rc
;
WepKeyRid
wkr
=
*
pwkr
;
WepKeyRid
wkr
=
*
pwkr
;
wkr
.
len
=
cpu_to_le16
(
wkr
.
len
);
wkr
.
len
=
cpu_to_le16
(
wkr
.
len
);
wkr
.
kindex
=
cpu_to_le16
(
wkr
.
kindex
);
wkr
.
kindex
=
cpu_to_le16
(
wkr
.
kindex
);
wkr
.
klen
=
cpu_to_le16
(
wkr
.
klen
);
wkr
.
klen
=
cpu_to_le16
(
wkr
.
klen
);
rc
=
PC4500_writerid
(
ai
,
RID_WEP_TEMP
,
&
wkr
,
sizeof
(
wkr
));
rc
=
PC4500_writerid
(
ai
,
RID_WEP_TEMP
,
&
wkr
,
sizeof
(
wkr
)
,
lock
);
if
(
rc
!=
SUCCESS
)
printk
(
KERN_ERR
"airo: WEP_TEMP set %x
\n
"
,
rc
);
if
(
rc
!=
SUCCESS
)
printk
(
KERN_ERR
"airo: WEP_TEMP set %x
\n
"
,
rc
);
if
(
perm
)
{
if
(
perm
)
{
rc
=
PC4500_writerid
(
ai
,
RID_WEP_PERM
,
&
wkr
,
sizeof
(
wkr
));
rc
=
PC4500_writerid
(
ai
,
RID_WEP_PERM
,
&
wkr
,
sizeof
(
wkr
)
,
lock
);
if
(
rc
!=
SUCCESS
)
{
if
(
rc
!=
SUCCESS
)
{
printk
(
KERN_ERR
"airo: WEP_PERM set %x
\n
"
,
rc
);
printk
(
KERN_ERR
"airo: WEP_PERM set %x
\n
"
,
rc
);
}
}
...
@@ -1129,7 +1128,7 @@ static int writeWepKeyRid(struct airo_info*ai, WepKeyRid *pwkr, int perm) {
...
@@ -1129,7 +1128,7 @@ static int writeWepKeyRid(struct airo_info*ai, WepKeyRid *pwkr, int perm) {
static
int
readSsidRid
(
struct
airo_info
*
ai
,
SsidRid
*
ssidr
)
{
static
int
readSsidRid
(
struct
airo_info
*
ai
,
SsidRid
*
ssidr
)
{
int
i
;
int
i
;
int
rc
=
PC4500_readrid
(
ai
,
RID_SSID
,
ssidr
,
sizeof
(
*
ssidr
));
int
rc
=
PC4500_readrid
(
ai
,
RID_SSID
,
ssidr
,
sizeof
(
*
ssidr
)
,
1
);
ssidr
->
len
=
le16_to_cpu
(
ssidr
->
len
);
ssidr
->
len
=
le16_to_cpu
(
ssidr
->
len
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
...
@@ -1146,10 +1145,10 @@ static int writeSsidRid(struct airo_info*ai, SsidRid *pssidr) {
...
@@ -1146,10 +1145,10 @@ static int writeSsidRid(struct airo_info*ai, SsidRid *pssidr) {
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
ssidr
.
ssids
[
i
].
len
=
cpu_to_le16
(
ssidr
.
ssids
[
i
].
len
);
ssidr
.
ssids
[
i
].
len
=
cpu_to_le16
(
ssidr
.
ssids
[
i
].
len
);
}
}
rc
=
PC4500_writerid
(
ai
,
RID_SSID
,
&
ssidr
,
sizeof
(
ssidr
));
rc
=
PC4500_writerid
(
ai
,
RID_SSID
,
&
ssidr
,
sizeof
(
ssidr
)
,
1
);
return
rc
;
return
rc
;
}
}
static
int
readConfigRid
(
struct
airo_info
*
ai
)
{
static
int
readConfigRid
(
struct
airo_info
*
ai
,
int
lock
)
{
int
rc
;
int
rc
;
u16
*
s
;
u16
*
s
;
ConfigRid
cfg
;
ConfigRid
cfg
;
...
@@ -1157,7 +1156,7 @@ static int readConfigRid(struct airo_info*ai) {
...
@@ -1157,7 +1156,7 @@ static int readConfigRid(struct airo_info*ai) {
if
(
ai
->
config
.
len
)
if
(
ai
->
config
.
len
)
return
SUCCESS
;
return
SUCCESS
;
rc
=
PC4500_readrid
(
ai
,
RID_ACTUALCONFIG
,
&
cfg
,
sizeof
(
cfg
));
rc
=
PC4500_readrid
(
ai
,
RID_ACTUALCONFIG
,
&
cfg
,
sizeof
(
cfg
)
,
lock
);
if
(
rc
!=
SUCCESS
)
if
(
rc
!=
SUCCESS
)
return
rc
;
return
rc
;
...
@@ -1186,7 +1185,7 @@ static inline void checkThrottle(struct airo_info *ai) {
...
@@ -1186,7 +1185,7 @@ static inline void checkThrottle(struct airo_info *ai) {
}
}
}
}
}
}
static
int
writeConfigRid
(
struct
airo_info
*
ai
)
{
static
int
writeConfigRid
(
struct
airo_info
*
ai
,
int
lock
)
{
u16
*
s
;
u16
*
s
;
ConfigRid
cfgr
;
ConfigRid
cfgr
;
...
@@ -1213,10 +1212,10 @@ static int writeConfigRid(struct airo_info*ai) {
...
@@ -1213,10 +1212,10 @@ static int writeConfigRid(struct airo_info*ai) {
for
(
s
=
&
cfgr
.
arlThreshold
;
s
<=
&
cfgr
.
autoWake
;
s
++
)
for
(
s
=
&
cfgr
.
arlThreshold
;
s
<=
&
cfgr
.
autoWake
;
s
++
)
*
s
=
cpu_to_le16
(
*
s
);
*
s
=
cpu_to_le16
(
*
s
);
return
PC4500_writerid
(
ai
,
RID_CONFIG
,
&
cfgr
,
sizeof
(
cfgr
));
return
PC4500_writerid
(
ai
,
RID_CONFIG
,
&
cfgr
,
sizeof
(
cfgr
)
,
lock
);
}
}
static
int
readStatusRid
(
struct
airo_info
*
ai
,
StatusRid
*
statr
)
{
static
int
readStatusRid
(
struct
airo_info
*
ai
,
StatusRid
*
statr
)
{
int
rc
=
PC4500_readrid
(
ai
,
RID_STATUS
,
statr
,
sizeof
(
*
statr
));
int
rc
=
PC4500_readrid
(
ai
,
RID_STATUS
,
statr
,
sizeof
(
*
statr
)
,
1
);
u16
*
s
;
u16
*
s
;
statr
->
len
=
le16_to_cpu
(
statr
->
len
);
statr
->
len
=
le16_to_cpu
(
statr
->
len
);
...
@@ -1226,22 +1225,21 @@ static int readStatusRid(struct airo_info*ai, StatusRid *statr) {
...
@@ -1226,22 +1225,21 @@ static int readStatusRid(struct airo_info*ai, StatusRid *statr) {
*
s
=
le16_to_cpu
(
*
s
);
*
s
=
le16_to_cpu
(
*
s
);
statr
->
load
=
le16_to_cpu
(
statr
->
load
);
statr
->
load
=
le16_to_cpu
(
statr
->
load
);
statr
->
assocStatus
=
le16_to_cpu
(
statr
->
assocStatus
);
statr
->
assocStatus
=
le16_to_cpu
(
statr
->
assocStatus
);
return
rc
;
return
rc
;
}
}
static
int
readAPListRid
(
struct
airo_info
*
ai
,
APListRid
*
aplr
)
{
static
int
readAPListRid
(
struct
airo_info
*
ai
,
APListRid
*
aplr
)
{
int
rc
=
PC4500_readrid
(
ai
,
RID_APLIST
,
aplr
,
sizeof
(
*
aplr
));
int
rc
=
PC4500_readrid
(
ai
,
RID_APLIST
,
aplr
,
sizeof
(
*
aplr
)
,
1
);
aplr
->
len
=
le16_to_cpu
(
aplr
->
len
);
aplr
->
len
=
le16_to_cpu
(
aplr
->
len
);
return
rc
;
return
rc
;
}
}
static
int
writeAPListRid
(
struct
airo_info
*
ai
,
APListRid
*
aplr
)
{
static
int
writeAPListRid
(
struct
airo_info
*
ai
,
APListRid
*
aplr
)
{
int
rc
;
int
rc
;
aplr
->
len
=
cpu_to_le16
(
aplr
->
len
);
aplr
->
len
=
cpu_to_le16
(
aplr
->
len
);
rc
=
PC4500_writerid
(
ai
,
RID_APLIST
,
aplr
,
sizeof
(
*
aplr
));
rc
=
PC4500_writerid
(
ai
,
RID_APLIST
,
aplr
,
sizeof
(
*
aplr
)
,
1
);
return
rc
;
return
rc
;
}
}
static
int
readCapabilityRid
(
struct
airo_info
*
ai
,
CapabilityRid
*
capr
)
{
static
int
readCapabilityRid
(
struct
airo_info
*
ai
,
CapabilityRid
*
capr
)
{
int
rc
=
PC4500_readrid
(
ai
,
RID_CAPABILITIES
,
capr
,
sizeof
(
*
capr
));
int
rc
=
PC4500_readrid
(
ai
,
RID_CAPABILITIES
,
capr
,
sizeof
(
*
capr
)
,
1
);
u16
*
s
;
u16
*
s
;
capr
->
len
=
le16_to_cpu
(
capr
->
len
);
capr
->
len
=
le16_to_cpu
(
capr
->
len
);
...
@@ -1252,8 +1250,8 @@ static int readCapabilityRid(struct airo_info*ai, CapabilityRid *capr) {
...
@@ -1252,8 +1250,8 @@ static int readCapabilityRid(struct airo_info*ai, CapabilityRid *capr) {
*
s
=
le16_to_cpu
(
*
s
);
*
s
=
le16_to_cpu
(
*
s
);
return
rc
;
return
rc
;
}
}
static
int
readStatsRid
(
struct
airo_info
*
ai
,
StatsRid
*
sr
,
int
rid
)
{
static
int
readStatsRid
(
struct
airo_info
*
ai
,
StatsRid
*
sr
,
int
rid
,
int
lock
)
{
int
rc
=
PC4500_readrid
(
ai
,
rid
,
sr
,
sizeof
(
*
sr
));
int
rc
=
PC4500_readrid
(
ai
,
rid
,
sr
,
sizeof
(
*
sr
)
,
lock
);
u32
*
i
;
u32
*
i
;
sr
->
len
=
le16_to_cpu
(
sr
->
len
);
sr
->
len
=
le16_to_cpu
(
sr
->
len
);
...
@@ -1273,8 +1271,8 @@ static int airo_open(struct net_device *dev) {
...
@@ -1273,8 +1271,8 @@ static int airo_open(struct net_device *dev) {
* is open (to pipeline changes and speed-up card setup). If
* is open (to pipeline changes and speed-up card setup). If
* those changes are not yet commited, do it now - Jean II */
* those changes are not yet commited, do it now - Jean II */
if
(
info
->
need_commit
)
{
if
(
info
->
need_commit
)
{
disable_MAC
(
info
);
disable_MAC
(
info
,
1
);
writeConfigRid
(
info
);
writeConfigRid
(
info
,
1
);
}
}
if
(
info
->
wifidev
!=
dev
)
{
if
(
info
->
wifidev
!=
dev
)
{
...
@@ -1282,7 +1280,7 @@ static int airo_open(struct net_device *dev) {
...
@@ -1282,7 +1280,7 @@ static int airo_open(struct net_device *dev) {
info
->
flags
&=
~
FLAG_RADIO_DOWN
;
info
->
flags
&=
~
FLAG_RADIO_DOWN
;
enable_interrupts
(
info
);
enable_interrupts
(
info
);
}
}
enable_MAC
(
info
,
&
rsp
);
enable_MAC
(
info
,
&
rsp
,
1
);
netif_start_queue
(
dev
);
netif_start_queue
(
dev
);
return
0
;
return
0
;
...
@@ -1468,7 +1466,7 @@ struct net_device_stats *airo_get_stats(struct net_device *dev)
...
@@ -1468,7 +1466,7 @@ struct net_device_stats *airo_get_stats(struct net_device *dev)
u32
*
vals
=
stats_rid
.
vals
;
u32
*
vals
=
stats_rid
.
vals
;
/* Get stats out of the card */
/* Get stats out of the card */
readStatsRid
(
local
,
&
stats_rid
,
RID_STATS
);
readStatsRid
(
local
,
&
stats_rid
,
RID_STATS
,
0
);
local
->
stats
.
rx_packets
=
vals
[
43
]
+
vals
[
44
]
+
vals
[
45
];
local
->
stats
.
rx_packets
=
vals
[
43
]
+
vals
[
44
]
+
vals
[
45
];
local
->
stats
.
tx_packets
=
vals
[
39
]
+
vals
[
40
]
+
vals
[
41
];
local
->
stats
.
tx_packets
=
vals
[
39
]
+
vals
[
40
]
+
vals
[
41
];
...
@@ -1538,9 +1536,9 @@ static int airo_set_mac_address(struct net_device *dev, void *p)
...
@@ -1538,9 +1536,9 @@ static int airo_set_mac_address(struct net_device *dev, void *p)
memcpy
(
ai
->
config
.
macAddr
,
addr
->
sa_data
,
dev
->
addr_len
);
memcpy
(
ai
->
config
.
macAddr
,
addr
->
sa_data
,
dev
->
addr_len
);
ai
->
need_commit
=
1
;
ai
->
need_commit
=
1
;
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
writeConfigRid
(
ai
);
writeConfigRid
(
ai
,
1
);
enable_MAC
(
ai
,
&
rsp
);
enable_MAC
(
ai
,
&
rsp
,
1
);
memcpy
(
ai
->
dev
->
dev_addr
,
addr
->
sa_data
,
dev
->
addr_len
);
memcpy
(
ai
->
dev
->
dev_addr
,
addr
->
sa_data
,
dev
->
addr_len
);
if
(
ai
->
wifidev
)
if
(
ai
->
wifidev
)
memcpy
(
ai
->
wifidev
->
dev_addr
,
addr
->
sa_data
,
dev
->
addr_len
);
memcpy
(
ai
->
wifidev
->
dev_addr
,
addr
->
sa_data
,
dev
->
addr_len
);
...
@@ -1569,7 +1567,7 @@ static int airo_close(struct net_device *dev) {
...
@@ -1569,7 +1567,7 @@ static int airo_close(struct net_device *dev) {
* stack (i.e. the network stack won't try to broadcast
* stack (i.e. the network stack won't try to broadcast
* anything on the interface and routes are gone. Jean II */
* anything on the interface and routes are gone. Jean II */
ai
->
flags
|=
FLAG_RADIO_DOWN
;
ai
->
flags
|=
FLAG_RADIO_DOWN
;
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
#endif
#endif
disable_interrupts
(
ai
);
disable_interrupts
(
ai
);
}
}
...
@@ -1793,6 +1791,9 @@ int reset_airo_card( struct net_device *dev ) {
...
@@ -1793,6 +1791,9 @@ int reset_airo_card( struct net_device *dev ) {
int
i
;
int
i
;
struct
airo_info
*
ai
=
dev
->
priv
;
struct
airo_info
*
ai
=
dev
->
priv
;
if
(
down_interruptible
(
&
ai
->
sem
))
return
-
1
;
waitbusy
(
ai
);
waitbusy
(
ai
);
OUT4500
(
ai
,
COMMAND
,
CMD_SOFTRESET
);
OUT4500
(
ai
,
COMMAND
,
CMD_SOFTRESET
);
set_current_state
(
TASK_UNINTERRUPTIBLE
);
set_current_state
(
TASK_UNINTERRUPTIBLE
);
...
@@ -1802,6 +1803,7 @@ int reset_airo_card( struct net_device *dev ) {
...
@@ -1802,6 +1803,7 @@ int reset_airo_card( struct net_device *dev ) {
schedule_timeout
(
HZ
/
5
);
schedule_timeout
(
HZ
/
5
);
if
(
setup_card
(
ai
,
dev
->
dev_addr
)
!=
SUCCESS
)
{
if
(
setup_card
(
ai
,
dev
->
dev_addr
)
!=
SUCCESS
)
{
printk
(
KERN_ERR
"airo: MAC could not be enabled
\n
"
);
printk
(
KERN_ERR
"airo: MAC could not be enabled
\n
"
);
up
(
&
ai
->
sem
);
return
-
1
;
return
-
1
;
}
else
{
}
else
{
printk
(
KERN_INFO
"airo: MAC enabled %s %x:%x:%x:%x:%x:%x
\n
"
,
printk
(
KERN_INFO
"airo: MAC enabled %s %x:%x:%x:%x:%x:%x
\n
"
,
...
@@ -1819,6 +1821,7 @@ int reset_airo_card( struct net_device *dev ) {
...
@@ -1819,6 +1821,7 @@ int reset_airo_card( struct net_device *dev ) {
}
}
enable_interrupts
(
ai
);
enable_interrupts
(
ai
);
netif_wake_queue
(
dev
);
netif_wake_queue
(
dev
);
up
(
&
ai
->
sem
);
return
0
;
return
0
;
}
}
...
@@ -1831,9 +1834,7 @@ static void airo_send_event(struct net_device *dev) {
...
@@ -1831,9 +1834,7 @@ static void airo_send_event(struct net_device *dev) {
StatusRid
status_rid
;
StatusRid
status_rid
;
if
(
down_trylock
(
&
ai
->
sem
)
==
0
)
{
if
(
down_trylock
(
&
ai
->
sem
)
==
0
)
{
__set_bit
(
FLAG_LOCKED
,
&
ai
->
flags
);
PC4500_readrid
(
ai
,
RID_STATUS
,
&
status_rid
,
sizeof
(
status_rid
),
0
);
PC4500_readrid
(
ai
,
RID_STATUS
,
&
status_rid
,
sizeof
(
status_rid
));
clear_bit
(
FLAG_LOCKED
,
&
ai
->
flags
);
up
(
&
ai
->
sem
);
up
(
&
ai
->
sem
);
wrqu
.
data
.
length
=
0
;
wrqu
.
data
.
length
=
0
;
wrqu
.
data
.
flags
=
0
;
wrqu
.
data
.
flags
=
0
;
...
@@ -1854,9 +1855,7 @@ static void airo_read_mic(struct airo_info *ai) {
...
@@ -1854,9 +1855,7 @@ static void airo_read_mic(struct airo_info *ai) {
MICRid
mic_rid
;
MICRid
mic_rid
;
if
(
down_trylock
(
&
ai
->
sem
)
==
0
)
{
if
(
down_trylock
(
&
ai
->
sem
)
==
0
)
{
__set_bit
(
FLAG_LOCKED
,
&
ai
->
flags
);
PC4500_readrid
(
ai
,
RID_MIC
,
&
mic_rid
,
sizeof
(
mic_rid
),
0
);
PC4500_readrid
(
ai
,
RID_MIC
,
&
mic_rid
,
sizeof
(
mic_rid
));
clear_bit
(
FLAG_LOCKED
,
&
ai
->
flags
);
up
(
&
ai
->
sem
);
up
(
&
ai
->
sem
);
#ifdef MICSUPPORT
#ifdef MICSUPPORT
micinit
(
ai
,
&
mic_rid
);
micinit
(
ai
,
&
mic_rid
);
...
@@ -2200,7 +2199,7 @@ static u16 IN4500( struct airo_info *ai, u16 reg ) {
...
@@ -2200,7 +2199,7 @@ static u16 IN4500( struct airo_info *ai, u16 reg ) {
return
rc
;
return
rc
;
}
}
static
int
enable_MAC
(
struct
airo_info
*
ai
,
Resp
*
rsp
)
{
static
int
enable_MAC
(
struct
airo_info
*
ai
,
Resp
*
rsp
,
int
lock
)
{
int
rc
;
int
rc
;
Cmd
cmd
;
Cmd
cmd
;
...
@@ -2213,7 +2212,7 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp ) {
...
@@ -2213,7 +2212,7 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp ) {
if
(
ai
->
flags
&
(
FLAG_RADIO_OFF
|
FLAG_RADIO_DOWN
))
return
SUCCESS
;
if
(
ai
->
flags
&
(
FLAG_RADIO_OFF
|
FLAG_RADIO_DOWN
))
return
SUCCESS
;
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
cmd
.
cmd
=
MAC_ENABLE
;
cmd
.
cmd
=
MAC_ENABLE
;
if
(
test_bit
(
FLAG_LOCKED
,
&
ai
->
flags
)
!=
0
)
if
(
!
lock
)
return
issuecommand
(
ai
,
&
cmd
,
rsp
);
return
issuecommand
(
ai
,
&
cmd
,
rsp
);
if
(
down_interruptible
(
&
ai
->
sem
))
if
(
down_interruptible
(
&
ai
->
sem
))
...
@@ -2223,13 +2222,13 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp ) {
...
@@ -2223,13 +2222,13 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp ) {
return
rc
;
return
rc
;
}
}
static
void
disable_MAC
(
struct
airo_info
*
ai
)
{
static
void
disable_MAC
(
struct
airo_info
*
ai
,
int
lock
)
{
Cmd
cmd
;
Cmd
cmd
;
Resp
rsp
;
Resp
rsp
;
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
cmd
.
cmd
=
MAC_DISABLE
;
// disable in case already enabled
cmd
.
cmd
=
MAC_DISABLE
;
// disable in case already enabled
if
(
test_bit
(
FLAG_LOCKED
,
&
ai
->
flags
)
!=
0
)
{
if
(
!
lock
)
{
issuecommand
(
ai
,
&
cmd
,
&
rsp
);
issuecommand
(
ai
,
&
cmd
,
&
rsp
);
return
;
return
;
}
}
...
@@ -2307,13 +2306,13 @@ static u16 setup_card(struct airo_info *ai, u8 *mac)
...
@@ -2307,13 +2306,13 @@ static u16 setup_card(struct airo_info *ai, u8 *mac)
CapabilityRid
cap_rid
;
CapabilityRid
cap_rid
;
// general configuration (read/modify/write)
// general configuration (read/modify/write)
status
=
readConfigRid
(
ai
);
status
=
readConfigRid
(
ai
,
1
);
if
(
status
!=
SUCCESS
)
return
ERROR
;
if
(
status
!=
SUCCESS
)
return
ERROR
;
status
=
readCapabilityRid
(
ai
,
&
cap_rid
);
status
=
readCapabilityRid
(
ai
,
&
cap_rid
);
if
(
status
!=
SUCCESS
)
return
ERROR
;
if
(
status
!=
SUCCESS
)
return
ERROR
;
status
=
PC4500_readrid
(
ai
,
RID_RSSI
,
&
rssi_rid
,
sizeof
(
rssi_rid
));
status
=
PC4500_readrid
(
ai
,
RID_RSSI
,
&
rssi_rid
,
sizeof
(
rssi_rid
)
,
1
);
if
(
status
==
SUCCESS
)
{
if
(
status
==
SUCCESS
)
{
if
(
ai
->
rssi
||
(
ai
->
rssi
=
kmalloc
(
512
,
GFP_KERNEL
))
!=
NULL
)
if
(
ai
->
rssi
||
(
ai
->
rssi
=
kmalloc
(
512
,
GFP_KERNEL
))
!=
NULL
)
memcpy
(
ai
->
rssi
,
(
u8
*
)
&
rssi_rid
+
2
,
512
);
memcpy
(
ai
->
rssi
,
(
u8
*
)
&
rssi_rid
+
2
,
512
);
...
@@ -2377,14 +2376,14 @@ static u16 setup_card(struct airo_info *ai, u8 *mac)
...
@@ -2377,14 +2376,14 @@ static u16 setup_card(struct airo_info *ai, u8 *mac)
}
}
}
}
status
=
writeConfigRid
(
ai
);
status
=
writeConfigRid
(
ai
,
1
);
if
(
status
!=
SUCCESS
)
return
ERROR
;
if
(
status
!=
SUCCESS
)
return
ERROR
;
/* Set up the SSID list */
/* Set up the SSID list */
status
=
writeSsidRid
(
ai
,
&
mySsid
);
status
=
writeSsidRid
(
ai
,
&
mySsid
);
if
(
status
!=
SUCCESS
)
return
ERROR
;
if
(
status
!=
SUCCESS
)
return
ERROR
;
status
=
enable_MAC
(
ai
,
&
rsp
);
status
=
enable_MAC
(
ai
,
&
rsp
,
1
);
if
(
status
!=
SUCCESS
||
(
rsp
.
status
&
0xFF00
)
!=
0
)
{
if
(
status
!=
SUCCESS
||
(
rsp
.
status
&
0xFF00
)
!=
0
)
{
printk
(
KERN_ERR
"airo: Bad MAC enable reason = %x, rid = %x, offset = %d
\n
"
,
rsp
.
rsp0
,
rsp
.
rsp1
,
rsp
.
rsp2
);
printk
(
KERN_ERR
"airo: Bad MAC enable reason = %x, rid = %x, offset = %d
\n
"
,
rsp
.
rsp0
,
rsp
.
rsp1
,
rsp
.
rsp2
);
return
ERROR
;
return
ERROR
;
...
@@ -2599,13 +2598,12 @@ static int PC4500_accessrid(struct airo_info *ai, u16 rid, u16 accmd)
...
@@ -2599,13 +2598,12 @@ static int PC4500_accessrid(struct airo_info *ai, u16 rid, u16 accmd)
/* Note, that we are using BAP1 which is also used by transmit, so
/* Note, that we are using BAP1 which is also used by transmit, so
* we must get a lock. */
* we must get a lock. */
static
int
PC4500_readrid
(
struct
airo_info
*
ai
,
u16
rid
,
void
*
pBuf
,
int
len
)
static
int
PC4500_readrid
(
struct
airo_info
*
ai
,
u16
rid
,
void
*
pBuf
,
int
len
,
int
lock
)
{
{
u16
status
,
dolock
=
0
;
u16
status
;
int
rc
=
SUCCESS
;
int
rc
=
SUCCESS
;
if
(
test_bit
(
FLAG_LOCKED
,
&
ai
->
flags
)
==
0
)
{
if
(
lock
)
{
dolock
=
1
;
if
(
down_interruptible
(
&
ai
->
sem
))
if
(
down_interruptible
(
&
ai
->
sem
))
return
ERROR
;
return
ERROR
;
}
}
...
@@ -2633,7 +2631,7 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len)
...
@@ -2633,7 +2631,7 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len)
// read remainder of the rid
// read remainder of the rid
rc
=
bap_read
(
ai
,
((
u16
*
)
pBuf
)
+
1
,
len
,
BAP1
);
rc
=
bap_read
(
ai
,
((
u16
*
)
pBuf
)
+
1
,
len
,
BAP1
);
done:
done:
if
(
do
lock
)
if
(
lock
)
up
(
&
ai
->
sem
);
up
(
&
ai
->
sem
);
return
rc
;
return
rc
;
}
}
...
@@ -2641,13 +2639,12 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len)
...
@@ -2641,13 +2639,12 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len)
/* Note, that we are using BAP1 which is also used by transmit, so
/* Note, that we are using BAP1 which is also used by transmit, so
* make sure this isnt called when a transmit is happening */
* make sure this isnt called when a transmit is happening */
static
int
PC4500_writerid
(
struct
airo_info
*
ai
,
u16
rid
,
static
int
PC4500_writerid
(
struct
airo_info
*
ai
,
u16
rid
,
const
void
*
pBuf
,
int
len
)
const
void
*
pBuf
,
int
len
,
int
lock
)
{
{
u16
status
,
dolock
=
0
;
u16
status
;
int
rc
=
SUCCESS
;
int
rc
=
SUCCESS
;
if
(
test_bit
(
FLAG_LOCKED
,
&
ai
->
flags
)
==
0
)
{
if
(
lock
)
{
dolock
=
1
;
if
(
down_interruptible
(
&
ai
->
sem
))
if
(
down_interruptible
(
&
ai
->
sem
))
return
ERROR
;
return
ERROR
;
}
}
...
@@ -2665,7 +2662,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
...
@@ -2665,7 +2662,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
// ---now commit the rid data
// ---now commit the rid data
rc
=
PC4500_accessrid
(
ai
,
rid
,
0x100
|
CMD_ACCESS
);
rc
=
PC4500_accessrid
(
ai
,
rid
,
0x100
|
CMD_ACCESS
);
done:
done:
if
(
do
lock
)
if
(
lock
)
up
(
&
ai
->
sem
);
up
(
&
ai
->
sem
);
return
rc
;
return
rc
;
}
}
...
@@ -3191,7 +3188,7 @@ static int proc_stats_rid_open( struct inode *inode,
...
@@ -3191,7 +3188,7 @@ static int proc_stats_rid_open( struct inode *inode,
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
readStatsRid
(
apriv
,
&
stats
,
rid
);
readStatsRid
(
apriv
,
&
stats
,
rid
,
1
);
j
=
0
;
j
=
0
;
for
(
i
=
0
;
statsLabels
[
i
]
!=
(
char
*
)
-
1
&&
for
(
i
=
0
;
statsLabels
[
i
]
!=
(
char
*
)
-
1
&&
...
@@ -3237,7 +3234,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
...
@@ -3237,7 +3234,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
if
(
!
data
->
writelen
)
return
;
if
(
!
data
->
writelen
)
return
;
readConfigRid
(
ai
);
readConfigRid
(
ai
,
1
);
line
=
data
->
wbuffer
;
line
=
data
->
wbuffer
;
while
(
line
[
0
]
)
{
while
(
line
[
0
]
)
{
...
@@ -3423,7 +3420,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
...
@@ -3423,7 +3420,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
while
(
line
[
0
]
&&
line
[
0
]
!=
'\n'
)
line
++
;
while
(
line
[
0
]
&&
line
[
0
]
!=
'\n'
)
line
++
;
if
(
line
[
0
]
)
line
++
;
if
(
line
[
0
]
)
line
++
;
}
}
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
if
(
need_reset
)
{
if
(
need_reset
)
{
APListRid
APList_rid
;
APListRid
APList_rid
;
SsidRid
SSID_rid
;
SsidRid
SSID_rid
;
...
@@ -3431,12 +3428,12 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
...
@@ -3431,12 +3428,12 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
readAPListRid
(
ai
,
&
APList_rid
);
readAPListRid
(
ai
,
&
APList_rid
);
readSsidRid
(
ai
,
&
SSID_rid
);
readSsidRid
(
ai
,
&
SSID_rid
);
reset_airo_card
(
dev
);
reset_airo_card
(
dev
);
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
writeSsidRid
(
ai
,
&
SSID_rid
);
writeSsidRid
(
ai
,
&
SSID_rid
);
writeAPListRid
(
ai
,
&
APList_rid
);
writeAPListRid
(
ai
,
&
APList_rid
);
}
}
writeConfigRid
(
ai
);
writeConfigRid
(
ai
,
1
);
enable_MAC
(
ai
,
&
rsp
);
enable_MAC
(
ai
,
&
rsp
,
1
);
if
(
need_reset
)
if
(
need_reset
)
airo_set_promisc
(
ai
);
airo_set_promisc
(
ai
);
}
}
...
@@ -3474,7 +3471,7 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
...
@@ -3474,7 +3471,7 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
data
->
maxwritelen
=
2048
;
data
->
maxwritelen
=
2048
;
data
->
on_close
=
proc_config_on_close
;
data
->
on_close
=
proc_config_on_close
;
readConfigRid
(
ai
);
readConfigRid
(
ai
,
1
);
i
=
sprintf
(
data
->
rbuffer
,
i
=
sprintf
(
data
->
rbuffer
,
"Mode: %s
\n
"
"Mode: %s
\n
"
...
@@ -3566,9 +3563,9 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) {
...
@@ -3566,9 +3563,9 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) {
offset
<
data
->
writelen
)
offset
++
;
offset
<
data
->
writelen
)
offset
++
;
offset
++
;
offset
++
;
}
}
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
writeSsidRid
(
ai
,
&
SSID_rid
);
writeSsidRid
(
ai
,
&
SSID_rid
);
enable_MAC
(
ai
,
&
rsp
);
enable_MAC
(
ai
,
&
rsp
,
1
);
}
}
inline
static
u8
hexVal
(
char
c
)
{
inline
static
u8
hexVal
(
char
c
)
{
...
@@ -3607,20 +3604,20 @@ static void proc_APList_on_close( struct inode *inode, struct file *file ) {
...
@@ -3607,20 +3604,20 @@ static void proc_APList_on_close( struct inode *inode, struct file *file ) {
}
}
}
}
}
}
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
writeAPListRid
(
ai
,
&
APList_rid
);
writeAPListRid
(
ai
,
&
APList_rid
);
enable_MAC
(
ai
,
&
rsp
);
enable_MAC
(
ai
,
&
rsp
,
1
);
}
}
/* This function wraps PC4500_writerid with a MAC disable */
/* This function wraps PC4500_writerid with a MAC disable */
static
int
do_writerid
(
struct
airo_info
*
ai
,
u16
rid
,
const
void
*
rid_data
,
static
int
do_writerid
(
struct
airo_info
*
ai
,
u16
rid
,
const
void
*
rid_data
,
int
len
)
{
int
len
,
int
dummy
)
{
int
rc
;
int
rc
;
Resp
rsp
;
Resp
rsp
;
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
rc
=
PC4500_writerid
(
ai
,
rid
,
rid_data
,
len
);
rc
=
PC4500_writerid
(
ai
,
rid
,
rid_data
,
len
,
1
);
enable_MAC
(
ai
,
&
rsp
);
enable_MAC
(
ai
,
&
rsp
,
1
);
return
rc
;
return
rc
;
}
}
...
@@ -3648,7 +3645,7 @@ static int get_wep_key(struct airo_info *ai, u16 index) {
...
@@ -3648,7 +3645,7 @@ static int get_wep_key(struct airo_info *ai, u16 index) {
}
}
static
int
set_wep_key
(
struct
airo_info
*
ai
,
u16
index
,
static
int
set_wep_key
(
struct
airo_info
*
ai
,
u16
index
,
const
char
*
key
,
u16
keylen
,
int
perm
)
{
const
char
*
key
,
u16
keylen
,
int
perm
,
int
lock
)
{
static
const
unsigned
char
macaddr
[
ETH_ALEN
]
=
{
0x01
,
0
,
0
,
0
,
0
,
0
};
static
const
unsigned
char
macaddr
[
ETH_ALEN
]
=
{
0x01
,
0
,
0
,
0
,
0
,
0
};
WepKeyRid
wkr
;
WepKeyRid
wkr
;
...
@@ -3670,7 +3667,7 @@ static int set_wep_key(struct airo_info *ai, u16 index,
...
@@ -3670,7 +3667,7 @@ static int set_wep_key(struct airo_info *ai, u16 index,
printk
(
KERN_INFO
"Setting key %d
\n
"
,
index
);
printk
(
KERN_INFO
"Setting key %d
\n
"
,
index
);
}
}
writeWepKeyRid
(
ai
,
&
wkr
,
perm
);
writeWepKeyRid
(
ai
,
&
wkr
,
perm
,
lock
);
return
0
;
return
0
;
}
}
...
@@ -3693,7 +3690,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
...
@@ -3693,7 +3690,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
(
data
->
wbuffer
[
1
]
==
' '
||
data
->
wbuffer
[
1
]
==
'\n'
))
{
(
data
->
wbuffer
[
1
]
==
' '
||
data
->
wbuffer
[
1
]
==
'\n'
))
{
index
=
data
->
wbuffer
[
0
]
-
'0'
;
index
=
data
->
wbuffer
[
0
]
-
'0'
;
if
(
data
->
wbuffer
[
1
]
==
'\n'
)
{
if
(
data
->
wbuffer
[
1
]
==
'\n'
)
{
set_wep_key
(
ai
,
index
,
0
,
0
,
1
);
set_wep_key
(
ai
,
index
,
0
,
0
,
1
,
1
);
return
;
return
;
}
}
j
=
2
;
j
=
2
;
...
@@ -3712,7 +3709,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
...
@@ -3712,7 +3709,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
break
;
break
;
}
}
}
}
set_wep_key
(
ai
,
index
,
key
,
i
/
3
,
1
);
set_wep_key
(
ai
,
index
,
key
,
i
/
3
,
1
,
1
);
}
}
static
int
proc_wepkey_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
static
int
proc_wepkey_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
...
@@ -3959,10 +3956,9 @@ static void timer_func( u_long data ) {
...
@@ -3959,10 +3956,9 @@ static void timer_func( u_long data ) {
add_timer
(
&
apriv
->
timer
);
add_timer
(
&
apriv
->
timer
);
return
;
return
;
}
}
__set_bit
(
FLAG_LOCKED
,
&
apriv
->
flags
);
readConfigRid
(
apriv
);
readConfigRid
(
apriv
,
0
);
disable_MAC
(
apriv
);
disable_MAC
(
apriv
,
0
);
switch
(
apriv
->
config
.
authType
)
{
switch
(
apriv
->
config
.
authType
)
{
case
AUTH_ENCRYPT
:
case
AUTH_ENCRYPT
:
/* So drop to OPEN */
/* So drop to OPEN */
...
@@ -3970,13 +3966,13 @@ static void timer_func( u_long data ) {
...
@@ -3970,13 +3966,13 @@ static void timer_func( u_long data ) {
break
;
break
;
case
AUTH_SHAREDKEY
:
case
AUTH_SHAREDKEY
:
if
(
apriv
->
keyindex
<
auto_wep
)
{
if
(
apriv
->
keyindex
<
auto_wep
)
{
set_wep_key
(
apriv
,
apriv
->
keyindex
,
0
,
0
,
0
);
set_wep_key
(
apriv
,
apriv
->
keyindex
,
0
,
0
,
0
,
0
);
apriv
->
config
.
authType
=
AUTH_SHAREDKEY
;
apriv
->
config
.
authType
=
AUTH_SHAREDKEY
;
apriv
->
keyindex
++
;
apriv
->
keyindex
++
;
}
else
{
}
else
{
/* Drop to ENCRYPT */
/* Drop to ENCRYPT */
apriv
->
keyindex
=
0
;
apriv
->
keyindex
=
0
;
set_wep_key
(
apriv
,
apriv
->
defindex
,
0
,
0
,
0
);
set_wep_key
(
apriv
,
apriv
->
defindex
,
0
,
0
,
0
,
0
);
apriv
->
config
.
authType
=
AUTH_ENCRYPT
;
apriv
->
config
.
authType
=
AUTH_ENCRYPT
;
}
}
break
;
break
;
...
@@ -3984,9 +3980,8 @@ static void timer_func( u_long data ) {
...
@@ -3984,9 +3980,8 @@ static void timer_func( u_long data ) {
apriv
->
config
.
authType
=
AUTH_SHAREDKEY
;
apriv
->
config
.
authType
=
AUTH_SHAREDKEY
;
}
}
apriv
->
need_commit
=
1
;
apriv
->
need_commit
=
1
;
writeConfigRid
(
apriv
);
writeConfigRid
(
apriv
,
0
);
enable_MAC
(
apriv
,
&
rsp
);
enable_MAC
(
apriv
,
&
rsp
,
0
);
clear_bit
(
FLAG_LOCKED
,
&
apriv
->
flags
);
up
(
&
apriv
->
sem
);
up
(
&
apriv
->
sem
);
/* Schedule check to see if the change worked */
/* Schedule check to see if the change worked */
...
@@ -4222,9 +4217,9 @@ static int airo_set_essid(struct net_device *dev,
...
@@ -4222,9 +4217,9 @@ static int airo_set_essid(struct net_device *dev,
SSID_rid
.
ssids
[
index
].
len
=
dwrq
->
length
-
1
;
SSID_rid
.
ssids
[
index
].
len
=
dwrq
->
length
-
1
;
}
}
/* Write it to the card */
/* Write it to the card */
disable_MAC
(
local
);
disable_MAC
(
local
,
1
);
writeSsidRid
(
local
,
&
SSID_rid
);
writeSsidRid
(
local
,
&
SSID_rid
);
enable_MAC
(
local
,
&
rsp
);
enable_MAC
(
local
,
&
rsp
,
1
);
return
0
;
return
0
;
}
}
...
@@ -4286,9 +4281,9 @@ static int airo_set_wap(struct net_device *dev,
...
@@ -4286,9 +4281,9 @@ static int airo_set_wap(struct net_device *dev,
memset
(
&
APList_rid
,
0
,
sizeof
(
APList_rid
));
memset
(
&
APList_rid
,
0
,
sizeof
(
APList_rid
));
APList_rid
.
len
=
sizeof
(
APList_rid
);
APList_rid
.
len
=
sizeof
(
APList_rid
);
memcpy
(
APList_rid
.
ap
[
0
],
awrq
->
sa_data
,
ETH_ALEN
);
memcpy
(
APList_rid
.
ap
[
0
],
awrq
->
sa_data
,
ETH_ALEN
);
disable_MAC
(
local
);
disable_MAC
(
local
,
1
);
writeAPListRid
(
local
,
&
APList_rid
);
writeAPListRid
(
local
,
&
APList_rid
);
enable_MAC
(
local
,
&
rsp
);
enable_MAC
(
local
,
&
rsp
,
1
);
}
}
return
0
;
return
0
;
}
}
...
@@ -4644,7 +4639,7 @@ static int airo_set_encode(struct net_device *dev,
...
@@ -4644,7 +4639,7 @@ static int airo_set_encode(struct net_device *dev,
/* Copy the key in the driver */
/* Copy the key in the driver */
memcpy
(
key
.
key
,
extra
,
dwrq
->
length
);
memcpy
(
key
.
key
,
extra
,
dwrq
->
length
);
/* Send the key to the card */
/* Send the key to the card */
set_wep_key
(
local
,
index
,
key
.
key
,
key
.
len
,
1
);
set_wep_key
(
local
,
index
,
key
.
key
,
key
.
len
,
1
,
1
);
}
}
/* WE specify that if a valid key is set, encryption
/* WE specify that if a valid key is set, encryption
* should be enabled (user may turn it off later)
* should be enabled (user may turn it off later)
...
@@ -4658,7 +4653,7 @@ static int airo_set_encode(struct net_device *dev,
...
@@ -4658,7 +4653,7 @@ static int airo_set_encode(struct net_device *dev,
/* Do we want to just set the transmit key index ? */
/* Do we want to just set the transmit key index ? */
int
index
=
(
dwrq
->
flags
&
IW_ENCODE_INDEX
)
-
1
;
int
index
=
(
dwrq
->
flags
&
IW_ENCODE_INDEX
)
-
1
;
if
((
index
>=
0
)
&&
(
index
<
(
cap_rid
.
softCap
&
0x80
)
?
4
:
1
))
{
if
((
index
>=
0
)
&&
(
index
<
(
cap_rid
.
softCap
&
0x80
)
?
4
:
1
))
{
set_wep_key
(
local
,
index
,
0
,
0
,
1
);
set_wep_key
(
local
,
index
,
0
,
0
,
1
,
1
);
}
else
}
else
/* Don't complain if only change the mode */
/* Don't complain if only change the mode */
if
(
!
dwrq
->
flags
&
IW_ENCODE_MODE
)
{
if
(
!
dwrq
->
flags
&
IW_ENCODE_MODE
)
{
...
@@ -5303,7 +5298,7 @@ static int airo_get_scan(struct net_device *dev,
...
@@ -5303,7 +5298,7 @@ static int airo_get_scan(struct net_device *dev,
* consequences are begnign. So I don't bother fixing it - Javier */
* consequences are begnign. So I don't bother fixing it - Javier */
/* Try to read the first entry of the scan result */
/* Try to read the first entry of the scan result */
rc
=
PC4500_readrid
(
ai
,
RID_BSSLISTFIRST
,
&
BSSList
,
sizeof
(
BSSList
));
rc
=
PC4500_readrid
(
ai
,
RID_BSSLISTFIRST
,
&
BSSList
,
sizeof
(
BSSList
)
,
1
);
if
((
rc
)
||
(
BSSList
.
index
==
0xffff
))
{
if
((
rc
)
||
(
BSSList
.
index
==
0xffff
))
{
/* Client error, no scan results...
/* Client error, no scan results...
* The caller need to restart the scan. */
* The caller need to restart the scan. */
...
@@ -5319,7 +5314,7 @@ static int airo_get_scan(struct net_device *dev,
...
@@ -5319,7 +5314,7 @@ static int airo_get_scan(struct net_device *dev,
/* Read next entry */
/* Read next entry */
rc
=
PC4500_readrid
(
ai
,
RID_BSSLISTNEXT
,
rc
=
PC4500_readrid
(
ai
,
RID_BSSLISTNEXT
,
&
BSSList
,
sizeof
(
BSSList
));
&
BSSList
,
sizeof
(
BSSList
)
,
1
);
}
}
/* Length of data */
/* Length of data */
dwrq
->
length
=
(
current_ev
-
extra
);
dwrq
->
length
=
(
current_ev
-
extra
);
...
@@ -5409,9 +5404,9 @@ static int airo_config_commit(struct net_device *dev,
...
@@ -5409,9 +5404,9 @@ static int airo_config_commit(struct net_device *dev,
/* Some of the "SET" function may have modified some of the
/* Some of the "SET" function may have modified some of the
* parameters. It's now time to commit them in the card */
* parameters. It's now time to commit them in the card */
disable_MAC
(
local
);
disable_MAC
(
local
,
1
);
writeConfigRid
(
local
);
writeConfigRid
(
local
,
1
);
enable_MAC
(
local
,
&
rsp
);
enable_MAC
(
local
,
&
rsp
,
1
);
return
0
;
return
0
;
}
}
...
@@ -5895,7 +5890,7 @@ struct iw_statistics *airo_get_wireless_stats(struct net_device *dev)
...
@@ -5895,7 +5890,7 @@ struct iw_statistics *airo_get_wireless_stats(struct net_device *dev)
/* Get stats out of the card */
/* Get stats out of the card */
readStatusRid
(
local
,
&
status_rid
);
readStatusRid
(
local
,
&
status_rid
);
readStatsRid
(
local
,
&
stats_rid
,
RID_STATS
);
readStatsRid
(
local
,
&
stats_rid
,
RID_STATS
,
1
);
/* The status */
/* The status */
local
->
wstats
.
status
=
status_rid
.
mode
;
local
->
wstats
.
status
=
status_rid
.
mode
;
...
@@ -5940,7 +5935,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5940,7 +5935,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
switch
(
comp
->
command
)
switch
(
comp
->
command
)
{
{
case
AIROGCAP
:
ridcode
=
RID_CAPABILITIES
;
break
;
case
AIROGCAP
:
ridcode
=
RID_CAPABILITIES
;
break
;
case
AIROGCFG
:
writeConfigRid
(
ai
);
case
AIROGCFG
:
writeConfigRid
(
ai
,
1
);
ridcode
=
RID_CONFIG
;
break
;
ridcode
=
RID_CONFIG
;
break
;
case
AIROGSLIST
:
ridcode
=
RID_SSID
;
break
;
case
AIROGSLIST
:
ridcode
=
RID_SSID
;
break
;
case
AIROGVLIST
:
ridcode
=
RID_APLIST
;
break
;
case
AIROGVLIST
:
ridcode
=
RID_APLIST
;
break
;
...
@@ -5972,7 +5967,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5972,7 +5967,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
PC4500_readrid
(
ai
,
ridcode
,
iobuf
,
RIDS_SIZE
);
PC4500_readrid
(
ai
,
ridcode
,
iobuf
,
RIDS_SIZE
,
1
);
/* get the count of bytes in the rid docs say 1st 2 bytes is it.
/* get the count of bytes in the rid docs say 1st 2 bytes is it.
* then return it to the user
* then return it to the user
* 9/22/2000 Honor user given length
* 9/22/2000 Honor user given length
...
@@ -5995,7 +5990,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5995,7 +5990,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
struct
airo_info
*
ai
=
dev
->
priv
;
struct
airo_info
*
ai
=
dev
->
priv
;
int
ridcode
,
enabled
;
int
ridcode
,
enabled
;
Resp
rsp
;
Resp
rsp
;
static
int
(
*
writer
)(
struct
airo_info
*
,
u16
rid
,
const
void
*
,
int
);
static
int
(
*
writer
)(
struct
airo_info
*
,
u16
rid
,
const
void
*
,
int
,
int
);
unsigned
char
*
iobuf
;
unsigned
char
*
iobuf
;
/* Only super-user can write RIDs */
/* Only super-user can write RIDs */
...
@@ -6025,7 +6020,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6025,7 +6020,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
* same with MAC off
* same with MAC off
*/
*/
case
AIROPMACON
:
case
AIROPMACON
:
if
(
enable_MAC
(
ai
,
&
rsp
)
!=
0
)
if
(
enable_MAC
(
ai
,
&
rsp
,
1
)
!=
0
)
return
-
EIO
;
return
-
EIO
;
return
0
;
return
0
;
...
@@ -6034,7 +6029,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6034,7 +6029,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
* as disable_MAC. it's probably so short the compiler does not gen one.
* as disable_MAC. it's probably so short the compiler does not gen one.
*/
*/
case
AIROPMACOFF
:
case
AIROPMACOFF
:
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
return
0
;
return
0
;
/* This command merely clears the counts does not actually store any data
/* This command merely clears the counts does not actually store any data
...
@@ -6045,7 +6040,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6045,7 +6040,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
PC4500_readrid
(
ai
,
RID_STATSDELTACLEAR
,
iobuf
,
RIDS_SIZE
);
PC4500_readrid
(
ai
,
RID_STATSDELTACLEAR
,
iobuf
,
RIDS_SIZE
,
1
);
enabled
=
ai
->
micstats
.
enabled
;
enabled
=
ai
->
micstats
.
enabled
;
memset
(
&
ai
->
micstats
,
0
,
sizeof
(
ai
->
micstats
));
memset
(
&
ai
->
micstats
,
0
,
sizeof
(
ai
->
micstats
));
...
@@ -6085,7 +6080,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6085,7 +6080,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
ai
->
flags
&=
~
FLAG_ADHOC
;
ai
->
flags
&=
~
FLAG_ADHOC
;
}
}
if
((
*
writer
)(
ai
,
ridcode
,
iobuf
,
comp
->
len
))
{
if
((
*
writer
)(
ai
,
ridcode
,
iobuf
,
comp
->
len
,
1
))
{
kfree
(
iobuf
);
kfree
(
iobuf
);
return
-
EIO
;
return
-
EIO
;
}
}
...
@@ -6168,7 +6163,7 @@ int flashcard(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6168,7 +6163,7 @@ int flashcard(struct net_device *dev, aironet_ioctl *comp) {
*/
*/
int
cmdreset
(
struct
airo_info
*
ai
)
{
int
cmdreset
(
struct
airo_info
*
ai
)
{
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
if
(
!
waitbusy
(
ai
)){
if
(
!
waitbusy
(
ai
)){
printk
(
KERN_INFO
"Waitbusy hang before RESET
\n
"
);
printk
(
KERN_INFO
"Waitbusy hang before RESET
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment