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 );
static
void
OUT4500
(
struct
airo_info
*
,
u16
register
,
u16
value
);
static
unsigned
short
IN4500
(
struct
airo_info
*
,
u16
register
);
static
u16
setup_card
(
struct
airo_info
*
,
u8
*
mac
);
static
int
enable_MAC
(
struct
airo_info
*
ai
,
Resp
*
rsp
);
static
void
disable_MAC
(
struct
airo_info
*
ai
);
static
int
enable_MAC
(
struct
airo_info
*
ai
,
Resp
*
rsp
,
int
lock
);
static
void
disable_MAC
(
struct
airo_info
*
ai
,
int
lock
);
static
void
enable_interrupts
(
struct
airo_info
*
);
static
void
disable_interrupts
(
struct
airo_info
*
);
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,
static
int
bap_write
(
struct
airo_info
*
,
const
u16
*
pu16Src
,
int
bytelen
,
int
whichbap
);
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
*
pBuf
,
int
len
);
*
pBuf
,
int
len
,
int
lock
);
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
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
);
...
...
@@ -1015,7 +1015,6 @@ struct airo_info {
#define FLAG_PROMISC IFF_PROMISC
/* 0x100 - include/linux/if.h */
#define FLAG_RADIO_OFF 0x02
/* User 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_ADHOC 0x01
/* Needed by MIC */
#define FLAG_MIC_CAPABLE 0x20
...
...
@@ -1085,7 +1084,7 @@ static int readBSSListRid(struct airo_info *ai, int first,
ai
->
task
=
NULL
;
}
rc
=
PC4500_readrid
(
ai
,
first
?
RID_BSSLISTFIRST
:
RID_BSSLISTNEXT
,
list
,
sizeof
(
*
list
));
list
,
sizeof
(
*
list
)
,
1
);
list
->
len
=
le16_to_cpu
(
list
->
len
);
list
->
index
=
le16_to_cpu
(
list
->
index
);
...
...
@@ -1100,7 +1099,7 @@ static int readBSSListRid(struct airo_info *ai, int first,
static
int
readWepKeyRid
(
struct
airo_info
*
ai
,
WepKeyRid
*
wkr
,
int
temp
)
{
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
->
kindex
=
le16_to_cpu
(
wkr
->
kindex
);
...
...
@@ -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
* 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
;
WepKeyRid
wkr
=
*
pwkr
;
wkr
.
len
=
cpu_to_le16
(
wkr
.
len
);
wkr
.
kindex
=
cpu_to_le16
(
wkr
.
kindex
);
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
(
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
)
{
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) {
static
int
readSsidRid
(
struct
airo_info
*
ai
,
SsidRid
*
ssidr
)
{
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
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
...
...
@@ -1146,10 +1145,10 @@ static int writeSsidRid(struct airo_info*ai, SsidRid *pssidr) {
for
(
i
=
0
;
i
<
3
;
i
++
)
{
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
;
}
static
int
readConfigRid
(
struct
airo_info
*
ai
)
{
static
int
readConfigRid
(
struct
airo_info
*
ai
,
int
lock
)
{
int
rc
;
u16
*
s
;
ConfigRid
cfg
;
...
...
@@ -1157,7 +1156,7 @@ static int readConfigRid(struct airo_info*ai) {
if
(
ai
->
config
.
len
)
return
SUCCESS
;
rc
=
PC4500_readrid
(
ai
,
RID_ACTUALCONFIG
,
&
cfg
,
sizeof
(
cfg
));
rc
=
PC4500_readrid
(
ai
,
RID_ACTUALCONFIG
,
&
cfg
,
sizeof
(
cfg
)
,
lock
);
if
(
rc
!=
SUCCESS
)
return
rc
;
...
...
@@ -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
;
ConfigRid
cfgr
;
...
...
@@ -1213,10 +1212,10 @@ static int writeConfigRid(struct airo_info*ai) {
for
(
s
=
&
cfgr
.
arlThreshold
;
s
<=
&
cfgr
.
autoWake
;
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
)
{
int
rc
=
PC4500_readrid
(
ai
,
RID_STATUS
,
statr
,
sizeof
(
*
statr
));
int
rc
=
PC4500_readrid
(
ai
,
RID_STATUS
,
statr
,
sizeof
(
*
statr
)
,
1
);
u16
*
s
;
statr
->
len
=
le16_to_cpu
(
statr
->
len
);
...
...
@@ -1226,22 +1225,21 @@ static int readStatusRid(struct airo_info*ai, StatusRid *statr) {
*
s
=
le16_to_cpu
(
*
s
);
statr
->
load
=
le16_to_cpu
(
statr
->
load
);
statr
->
assocStatus
=
le16_to_cpu
(
statr
->
assocStatus
);
return
rc
;
}
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
);
return
rc
;
}
static
int
writeAPListRid
(
struct
airo_info
*
ai
,
APListRid
*
aplr
)
{
int
rc
;
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
;
}
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
;
capr
->
len
=
le16_to_cpu
(
capr
->
len
);
...
...
@@ -1252,8 +1250,8 @@ static int readCapabilityRid(struct airo_info*ai, CapabilityRid *capr) {
*
s
=
le16_to_cpu
(
*
s
);
return
rc
;
}
static
int
readStatsRid
(
struct
airo_info
*
ai
,
StatsRid
*
sr
,
int
rid
)
{
int
rc
=
PC4500_readrid
(
ai
,
rid
,
sr
,
sizeof
(
*
sr
));
static
int
readStatsRid
(
struct
airo_info
*
ai
,
StatsRid
*
sr
,
int
rid
,
int
lock
)
{
int
rc
=
PC4500_readrid
(
ai
,
rid
,
sr
,
sizeof
(
*
sr
)
,
lock
);
u32
*
i
;
sr
->
len
=
le16_to_cpu
(
sr
->
len
);
...
...
@@ -1273,8 +1271,8 @@ static int airo_open(struct net_device *dev) {
* is open (to pipeline changes and speed-up card setup). If
* those changes are not yet commited, do it now - Jean II */
if
(
info
->
need_commit
)
{
disable_MAC
(
info
);
writeConfigRid
(
info
);
disable_MAC
(
info
,
1
);
writeConfigRid
(
info
,
1
);
}
if
(
info
->
wifidev
!=
dev
)
{
...
...
@@ -1282,7 +1280,7 @@ static int airo_open(struct net_device *dev) {
info
->
flags
&=
~
FLAG_RADIO_DOWN
;
enable_interrupts
(
info
);
}
enable_MAC
(
info
,
&
rsp
);
enable_MAC
(
info
,
&
rsp
,
1
);
netif_start_queue
(
dev
);
return
0
;
...
...
@@ -1468,7 +1466,7 @@ struct net_device_stats *airo_get_stats(struct net_device *dev)
u32
*
vals
=
stats_rid
.
vals
;
/* 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
.
tx_packets
=
vals
[
39
]
+
vals
[
40
]
+
vals
[
41
];
...
...
@@ -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
);
ai
->
need_commit
=
1
;
disable_MAC
(
ai
);
writeConfigRid
(
ai
);
enable_MAC
(
ai
,
&
rsp
);
disable_MAC
(
ai
,
1
);
writeConfigRid
(
ai
,
1
);
enable_MAC
(
ai
,
&
rsp
,
1
);
memcpy
(
ai
->
dev
->
dev_addr
,
addr
->
sa_data
,
dev
->
addr_len
);
if
(
ai
->
wifidev
)
memcpy
(
ai
->
wifidev
->
dev_addr
,
addr
->
sa_data
,
dev
->
addr_len
);
...
...
@@ -1569,7 +1567,7 @@ static int airo_close(struct net_device *dev) {
* stack (i.e. the network stack won't try to broadcast
* anything on the interface and routes are gone. Jean II */
ai
->
flags
|=
FLAG_RADIO_DOWN
;
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
#endif
disable_interrupts
(
ai
);
}
...
...
@@ -1793,6 +1791,9 @@ int reset_airo_card( struct net_device *dev ) {
int
i
;
struct
airo_info
*
ai
=
dev
->
priv
;
if
(
down_interruptible
(
&
ai
->
sem
))
return
-
1
;
waitbusy
(
ai
);
OUT4500
(
ai
,
COMMAND
,
CMD_SOFTRESET
);
set_current_state
(
TASK_UNINTERRUPTIBLE
);
...
...
@@ -1802,6 +1803,7 @@ int reset_airo_card( struct net_device *dev ) {
schedule_timeout
(
HZ
/
5
);
if
(
setup_card
(
ai
,
dev
->
dev_addr
)
!=
SUCCESS
)
{
printk
(
KERN_ERR
"airo: MAC could not be enabled
\n
"
);
up
(
&
ai
->
sem
);
return
-
1
;
}
else
{
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 ) {
}
enable_interrupts
(
ai
);
netif_wake_queue
(
dev
);
up
(
&
ai
->
sem
);
return
0
;
}
...
...
@@ -1831,9 +1834,7 @@ static void airo_send_event(struct net_device *dev) {
StatusRid
status_rid
;
if
(
down_trylock
(
&
ai
->
sem
)
==
0
)
{
__set_bit
(
FLAG_LOCKED
,
&
ai
->
flags
);
PC4500_readrid
(
ai
,
RID_STATUS
,
&
status_rid
,
sizeof
(
status_rid
));
clear_bit
(
FLAG_LOCKED
,
&
ai
->
flags
);
PC4500_readrid
(
ai
,
RID_STATUS
,
&
status_rid
,
sizeof
(
status_rid
),
0
);
up
(
&
ai
->
sem
);
wrqu
.
data
.
length
=
0
;
wrqu
.
data
.
flags
=
0
;
...
...
@@ -1854,9 +1855,7 @@ static void airo_read_mic(struct airo_info *ai) {
MICRid
mic_rid
;
if
(
down_trylock
(
&
ai
->
sem
)
==
0
)
{
__set_bit
(
FLAG_LOCKED
,
&
ai
->
flags
);
PC4500_readrid
(
ai
,
RID_MIC
,
&
mic_rid
,
sizeof
(
mic_rid
));
clear_bit
(
FLAG_LOCKED
,
&
ai
->
flags
);
PC4500_readrid
(
ai
,
RID_MIC
,
&
mic_rid
,
sizeof
(
mic_rid
),
0
);
up
(
&
ai
->
sem
);
#ifdef MICSUPPORT
micinit
(
ai
,
&
mic_rid
);
...
...
@@ -2200,7 +2199,7 @@ static u16 IN4500( struct airo_info *ai, u16 reg ) {
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
;
Cmd
cmd
;
...
...
@@ -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
;
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
cmd
.
cmd
=
MAC_ENABLE
;
if
(
test_bit
(
FLAG_LOCKED
,
&
ai
->
flags
)
!=
0
)
if
(
!
lock
)
return
issuecommand
(
ai
,
&
cmd
,
rsp
);
if
(
down_interruptible
(
&
ai
->
sem
))
...
...
@@ -2223,13 +2222,13 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp ) {
return
rc
;
}
static
void
disable_MAC
(
struct
airo_info
*
ai
)
{
static
void
disable_MAC
(
struct
airo_info
*
ai
,
int
lock
)
{
Cmd
cmd
;
Resp
rsp
;
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
cmd
.
cmd
=
MAC_DISABLE
;
// disable in case already enabled
if
(
test_bit
(
FLAG_LOCKED
,
&
ai
->
flags
)
!=
0
)
{
if
(
!
lock
)
{
issuecommand
(
ai
,
&
cmd
,
&
rsp
);
return
;
}
...
...
@@ -2307,13 +2306,13 @@ static u16 setup_card(struct airo_info *ai, u8 *mac)
CapabilityRid
cap_rid
;
// general configuration (read/modify/write)
status
=
readConfigRid
(
ai
);
status
=
readConfigRid
(
ai
,
1
);
if
(
status
!=
SUCCESS
)
return
ERROR
;
status
=
readCapabilityRid
(
ai
,
&
cap_rid
);
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
(
ai
->
rssi
||
(
ai
->
rssi
=
kmalloc
(
512
,
GFP_KERNEL
))
!=
NULL
)
memcpy
(
ai
->
rssi
,
(
u8
*
)
&
rssi_rid
+
2
,
512
);
...
...
@@ -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
;
/* Set up the SSID list */
status
=
writeSsidRid
(
ai
,
&
mySsid
);
if
(
status
!=
SUCCESS
)
return
ERROR
;
status
=
enable_MAC
(
ai
,
&
rsp
);
status
=
enable_MAC
(
ai
,
&
rsp
,
1
);
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
);
return
ERROR
;
...
...
@@ -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
* 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
;
if
(
test_bit
(
FLAG_LOCKED
,
&
ai
->
flags
)
==
0
)
{
dolock
=
1
;
if
(
lock
)
{
if
(
down_interruptible
(
&
ai
->
sem
))
return
ERROR
;
}
...
...
@@ -2633,7 +2631,7 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len)
// read remainder of the rid
rc
=
bap_read
(
ai
,
((
u16
*
)
pBuf
)
+
1
,
len
,
BAP1
);
done:
if
(
do
lock
)
if
(
lock
)
up
(
&
ai
->
sem
);
return
rc
;
}
...
...
@@ -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
* make sure this isnt called when a transmit is happening */
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
;
if
(
test_bit
(
FLAG_LOCKED
,
&
ai
->
flags
)
==
0
)
{
dolock
=
1
;
if
(
lock
)
{
if
(
down_interruptible
(
&
ai
->
sem
))
return
ERROR
;
}
...
...
@@ -2665,7 +2662,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
// ---now commit the rid data
rc
=
PC4500_accessrid
(
ai
,
rid
,
0x100
|
CMD_ACCESS
);
done:
if
(
do
lock
)
if
(
lock
)
up
(
&
ai
->
sem
);
return
rc
;
}
...
...
@@ -3191,7 +3188,7 @@ static int proc_stats_rid_open( struct inode *inode,
return
-
ENOMEM
;
}
readStatsRid
(
apriv
,
&
stats
,
rid
);
readStatsRid
(
apriv
,
&
stats
,
rid
,
1
);
j
=
0
;
for
(
i
=
0
;
statsLabels
[
i
]
!=
(
char
*
)
-
1
&&
...
...
@@ -3237,7 +3234,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
if
(
!
data
->
writelen
)
return
;
readConfigRid
(
ai
);
readConfigRid
(
ai
,
1
);
line
=
data
->
wbuffer
;
while
(
line
[
0
]
)
{
...
...
@@ -3423,7 +3420,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
while
(
line
[
0
]
&&
line
[
0
]
!=
'\n'
)
line
++
;
if
(
line
[
0
]
)
line
++
;
}
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
if
(
need_reset
)
{
APListRid
APList_rid
;
SsidRid
SSID_rid
;
...
...
@@ -3431,12 +3428,12 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
readAPListRid
(
ai
,
&
APList_rid
);
readSsidRid
(
ai
,
&
SSID_rid
);
reset_airo_card
(
dev
);
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
writeSsidRid
(
ai
,
&
SSID_rid
);
writeAPListRid
(
ai
,
&
APList_rid
);
}
writeConfigRid
(
ai
);
enable_MAC
(
ai
,
&
rsp
);
writeConfigRid
(
ai
,
1
);
enable_MAC
(
ai
,
&
rsp
,
1
);
if
(
need_reset
)
airo_set_promisc
(
ai
);
}
...
...
@@ -3474,7 +3471,7 @@ static int proc_config_open( struct inode *inode, struct file *file ) {
data
->
maxwritelen
=
2048
;
data
->
on_close
=
proc_config_on_close
;
readConfigRid
(
ai
);
readConfigRid
(
ai
,
1
);
i
=
sprintf
(
data
->
rbuffer
,
"Mode: %s
\n
"
...
...
@@ -3566,9 +3563,9 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) {
offset
<
data
->
writelen
)
offset
++
;
offset
++
;
}
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
writeSsidRid
(
ai
,
&
SSID_rid
);
enable_MAC
(
ai
,
&
rsp
);
enable_MAC
(
ai
,
&
rsp
,
1
);
}
inline
static
u8
hexVal
(
char
c
)
{
...
...
@@ -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
);
enable_MAC
(
ai
,
&
rsp
);
enable_MAC
(
ai
,
&
rsp
,
1
);
}
/* This function wraps PC4500_writerid with a MAC disable */
static
int
do_writerid
(
struct
airo_info
*
ai
,
u16
rid
,
const
void
*
rid_data
,
int
len
)
{
int
len
,
int
dummy
)
{
int
rc
;
Resp
rsp
;
disable_MAC
(
ai
);
rc
=
PC4500_writerid
(
ai
,
rid
,
rid_data
,
len
);
enable_MAC
(
ai
,
&
rsp
);
disable_MAC
(
ai
,
1
);
rc
=
PC4500_writerid
(
ai
,
rid
,
rid_data
,
len
,
1
);
enable_MAC
(
ai
,
&
rsp
,
1
);
return
rc
;
}
...
...
@@ -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
,
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
};
WepKeyRid
wkr
;
...
...
@@ -3670,7 +3667,7 @@ static int set_wep_key(struct airo_info *ai, u16 index,
printk
(
KERN_INFO
"Setting key %d
\n
"
,
index
);
}
writeWepKeyRid
(
ai
,
&
wkr
,
perm
);
writeWepKeyRid
(
ai
,
&
wkr
,
perm
,
lock
);
return
0
;
}
...
...
@@ -3693,7 +3690,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
(
data
->
wbuffer
[
1
]
==
' '
||
data
->
wbuffer
[
1
]
==
'\n'
))
{
index
=
data
->
wbuffer
[
0
]
-
'0'
;
if
(
data
->
wbuffer
[
1
]
==
'\n'
)
{
set_wep_key
(
ai
,
index
,
0
,
0
,
1
);
set_wep_key
(
ai
,
index
,
0
,
0
,
1
,
1
);
return
;
}
j
=
2
;
...
...
@@ -3712,7 +3709,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
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
)
{
...
...
@@ -3959,10 +3956,9 @@ static void timer_func( u_long data ) {
add_timer
(
&
apriv
->
timer
);
return
;
}
__set_bit
(
FLAG_LOCKED
,
&
apriv
->
flags
);
readConfigRid
(
apriv
);
disable_MAC
(
apriv
);
readConfigRid
(
apriv
,
0
);
disable_MAC
(
apriv
,
0
);
switch
(
apriv
->
config
.
authType
)
{
case
AUTH_ENCRYPT
:
/* So drop to OPEN */
...
...
@@ -3970,13 +3966,13 @@ static void timer_func( u_long data ) {
break
;
case
AUTH_SHAREDKEY
:
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
->
keyindex
++
;
}
else
{
/* Drop to ENCRYPT */
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
;
}
break
;
...
...
@@ -3984,9 +3980,8 @@ static void timer_func( u_long data ) {
apriv
->
config
.
authType
=
AUTH_SHAREDKEY
;
}
apriv
->
need_commit
=
1
;
writeConfigRid
(
apriv
);
enable_MAC
(
apriv
,
&
rsp
);
clear_bit
(
FLAG_LOCKED
,
&
apriv
->
flags
);
writeConfigRid
(
apriv
,
0
);
enable_MAC
(
apriv
,
&
rsp
,
0
);
up
(
&
apriv
->
sem
);
/* Schedule check to see if the change worked */
...
...
@@ -4222,9 +4217,9 @@ static int airo_set_essid(struct net_device *dev,
SSID_rid
.
ssids
[
index
].
len
=
dwrq
->
length
-
1
;
}
/* Write it to the card */
disable_MAC
(
local
);
disable_MAC
(
local
,
1
);
writeSsidRid
(
local
,
&
SSID_rid
);
enable_MAC
(
local
,
&
rsp
);
enable_MAC
(
local
,
&
rsp
,
1
);
return
0
;
}
...
...
@@ -4286,9 +4281,9 @@ static int airo_set_wap(struct net_device *dev,
memset
(
&
APList_rid
,
0
,
sizeof
(
APList_rid
));
APList_rid
.
len
=
sizeof
(
APList_rid
);
memcpy
(
APList_rid
.
ap
[
0
],
awrq
->
sa_data
,
ETH_ALEN
);
disable_MAC
(
local
);
disable_MAC
(
local
,
1
);
writeAPListRid
(
local
,
&
APList_rid
);
enable_MAC
(
local
,
&
rsp
);
enable_MAC
(
local
,
&
rsp
,
1
);
}
return
0
;
}
...
...
@@ -4644,7 +4639,7 @@ static int airo_set_encode(struct net_device *dev,
/* Copy the key in the driver */
memcpy
(
key
.
key
,
extra
,
dwrq
->
length
);
/* 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
* should be enabled (user may turn it off later)
...
...
@@ -4658,7 +4653,7 @@ static int airo_set_encode(struct net_device *dev,
/* Do we want to just set the transmit key index ? */
int
index
=
(
dwrq
->
flags
&
IW_ENCODE_INDEX
)
-
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
/* Don't complain if only change the mode */
if
(
!
dwrq
->
flags
&
IW_ENCODE_MODE
)
{
...
...
@@ -5303,7 +5298,7 @@ static int airo_get_scan(struct net_device *dev,
* consequences are begnign. So I don't bother fixing it - Javier */
/* 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
))
{
/* Client error, no scan results...
* The caller need to restart the scan. */
...
...
@@ -5319,7 +5314,7 @@ static int airo_get_scan(struct net_device *dev,
/* Read next entry */
rc
=
PC4500_readrid
(
ai
,
RID_BSSLISTNEXT
,
&
BSSList
,
sizeof
(
BSSList
));
&
BSSList
,
sizeof
(
BSSList
)
,
1
);
}
/* Length of data */
dwrq
->
length
=
(
current_ev
-
extra
);
...
...
@@ -5409,9 +5404,9 @@ static int airo_config_commit(struct net_device *dev,
/* Some of the "SET" function may have modified some of the
* parameters. It's now time to commit them in the card */
disable_MAC
(
local
);
writeConfigRid
(
local
);
enable_MAC
(
local
,
&
rsp
);
disable_MAC
(
local
,
1
);
writeConfigRid
(
local
,
1
);
enable_MAC
(
local
,
&
rsp
,
1
);
return
0
;
}
...
...
@@ -5895,7 +5890,7 @@ struct iw_statistics *airo_get_wireless_stats(struct net_device *dev)
/* Get stats out of the card */
readStatusRid
(
local
,
&
status_rid
);
readStatsRid
(
local
,
&
stats_rid
,
RID_STATS
);
readStatsRid
(
local
,
&
stats_rid
,
RID_STATS
,
1
);
/* The status */
local
->
wstats
.
status
=
status_rid
.
mode
;
...
...
@@ -5940,7 +5935,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
switch
(
comp
->
command
)
{
case
AIROGCAP
:
ridcode
=
RID_CAPABILITIES
;
break
;
case
AIROGCFG
:
writeConfigRid
(
ai
);
case
AIROGCFG
:
writeConfigRid
(
ai
,
1
);
ridcode
=
RID_CONFIG
;
break
;
case
AIROGSLIST
:
ridcode
=
RID_SSID
;
break
;
case
AIROGVLIST
:
ridcode
=
RID_APLIST
;
break
;
...
...
@@ -5972,7 +5967,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
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.
* then return it to the user
* 9/22/2000 Honor user given length
...
...
@@ -5995,7 +5990,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
struct
airo_info
*
ai
=
dev
->
priv
;
int
ridcode
,
enabled
;
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
;
/* Only super-user can write RIDs */
...
...
@@ -6025,7 +6020,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
* same with MAC off
*/
case
AIROPMACON
:
if
(
enable_MAC
(
ai
,
&
rsp
)
!=
0
)
if
(
enable_MAC
(
ai
,
&
rsp
,
1
)
!=
0
)
return
-
EIO
;
return
0
;
...
...
@@ -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.
*/
case
AIROPMACOFF
:
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
return
0
;
/* 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) {
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
return
-
ENOMEM
;
PC4500_readrid
(
ai
,
RID_STATSDELTACLEAR
,
iobuf
,
RIDS_SIZE
);
PC4500_readrid
(
ai
,
RID_STATSDELTACLEAR
,
iobuf
,
RIDS_SIZE
,
1
);
enabled
=
ai
->
micstats
.
enabled
;
memset
(
&
ai
->
micstats
,
0
,
sizeof
(
ai
->
micstats
));
...
...
@@ -6085,7 +6080,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
ai
->
flags
&=
~
FLAG_ADHOC
;
}
if
((
*
writer
)(
ai
,
ridcode
,
iobuf
,
comp
->
len
))
{
if
((
*
writer
)(
ai
,
ridcode
,
iobuf
,
comp
->
len
,
1
))
{
kfree
(
iobuf
);
return
-
EIO
;
}
...
...
@@ -6168,7 +6163,7 @@ int flashcard(struct net_device *dev, aironet_ioctl *comp) {
*/
int
cmdreset
(
struct
airo_info
*
ai
)
{
disable_MAC
(
ai
);
disable_MAC
(
ai
,
1
);
if
(
!
waitbusy
(
ai
)){
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