Commit 51b2a028 authored by Richard Kennedy's avatar Richard Kennedy Committed by Greg Kroah-Hartman

Staging: wlan-ng: refactor p80211wext.c to reduce text size.

Refactor the wext interface to reduce lines of code & module text size.

- add a helper function p80211wext_getmib
- rename p80211wext_dorequest to p80211wext_setmib
- refactor wext to call the get/set mib helpers and so reduce repeated code.

size reported text reduction :-
   text	   data	    bss	    dec	    hex	filename
   8343	    720	      0	   9063	   2367	p80211wext.o.patch
   9907	    720	      0	  10631	   2987	p80211wext.o.orig

Tested on x86_32 laptop, everything works correctly using NetworkManager,
and iwconfig & iwlist return sensible results when reading from the card.
Signed-off-by: default avatarRichard Kennedy <richard@rsk.demon.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 044bc96b
...@@ -125,18 +125,38 @@ static int qual_as_percent(int snr) ...@@ -125,18 +125,38 @@ static int qual_as_percent(int snr)
return 100; return 100;
} }
static int p80211wext_dorequest(wlandevice_t *wlandev, u32 did, u32 data) static int p80211wext_setmib(wlandevice_t *wlandev, u32 did, u32 data)
{ {
p80211msg_dot11req_mibset_t msg; p80211msg_dot11req_mibset_t msg;
p80211item_uint32_t mibitem; p80211item_uint32_t *mibitem =
(p80211item_uint32_t *)&msg.mibattribute.data;
int result; int result;
msg.msgcode = DIDmsg_dot11req_mibset; msg.msgcode = DIDmsg_dot11req_mibset;
memset(&mibitem, 0, sizeof(mibitem)); memset(mibitem, 0, sizeof(*mibitem));
mibitem.did = did; mibitem->did = did;
mibitem.data = data; mibitem->data = data;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); result = p80211req_dorequest(wlandev, (u8 *) &msg);
return result;
}
/*
* get a 32 bit mib value
*/
static int p80211wext_getmib(wlandevice_t *wlandev, u32 did, u32 *data)
{
p80211msg_dot11req_mibset_t msg;
p80211item_uint32_t *mibitem =
(p80211item_uint32_t *)&msg.mibattribute.data;
int result;
msg.msgcode = DIDmsg_dot11req_mibget;
memset(mibitem, 0, sizeof(*mibitem));
mibitem->did = did;
result = p80211req_dorequest(wlandev, (u8 *) &msg); result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (!result)
*data = mibitem->data;
return result; return result;
} }
...@@ -262,32 +282,26 @@ static int p80211wext_giwfreq(netdevice_t *dev, ...@@ -262,32 +282,26 @@ static int p80211wext_giwfreq(netdevice_t *dev,
struct iw_freq *freq, char *extra) struct iw_freq *freq, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
msg.msgcode = DIDmsg_dot11req_mibget; result = p80211wext_getmib(wlandev,
memset(&mibitem, 0, sizeof(mibitem)); DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
mibitem.did = DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel; &value);
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); if (value > NUM_CHANNELS) {
if (mibitem.data > NUM_CHANNELS) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
/* convert into frequency instead of a channel */ /* convert into frequency instead of a channel */
freq->e = 1; freq->e = 1;
freq->m = p80211_channel_to_mhz(mibitem.data, 0) * 100000; freq->m = p80211_channel_to_mhz(value, 0) * 100000;
exit: exit:
return err; return err;
...@@ -298,28 +312,23 @@ static int p80211wext_siwfreq(netdevice_t *dev, ...@@ -298,28 +312,23 @@ static int p80211wext_siwfreq(netdevice_t *dev,
struct iw_freq *freq, char *extra) struct iw_freq *freq, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
if (!wlan_wext_write) { if (!wlan_wext_write) {
err = (-EOPNOTSUPP); err = -EOPNOTSUPP;
goto exit; goto exit;
} }
msg.msgcode = DIDmsg_dot11req_mibset;
memset(&mibitem, 0, sizeof(mibitem));
mibitem.did = DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel;
mibitem.status = P80211ENUM_msgitem_status_data_ok;
if ((freq->e == 0) && (freq->m <= 1000)) if ((freq->e == 0) && (freq->m <= 1000))
mibitem.data = freq->m; value = freq->m;
else else
mibitem.data = p80211_mhz_to_channel(freq->m); value = p80211_mhz_to_channel(freq->m);
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); result = p80211wext_setmib(wlandev,
result = p80211req_dorequest(wlandev, (u8 *) &msg); DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
value);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
...@@ -359,13 +368,11 @@ static int p80211wext_siwmode(netdevice_t *dev, ...@@ -359,13 +368,11 @@ static int p80211wext_siwmode(netdevice_t *dev,
__u32 *mode, char *extra) __u32 *mode, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
if (!wlan_wext_write) { if (!wlan_wext_write) {
err = (-EOPNOTSUPP); err = -EOPNOTSUPP;
goto exit; goto exit;
} }
...@@ -396,16 +403,11 @@ static int p80211wext_siwmode(netdevice_t *dev, ...@@ -396,16 +403,11 @@ static int p80211wext_siwmode(netdevice_t *dev,
} }
/* Set Operation mode to the PORT TYPE RID */ /* Set Operation mode to the PORT TYPE RID */
msg.msgcode = DIDmsg_dot11req_mibset; result = p80211wext_setmib(wlandev,
memset(&mibitem, 0, sizeof(mibitem)); DIDmib_p2_p2Static_p2CnfPortType,
mibitem.did = DIDmib_p2_p2Static_p2CnfPortType; (*mode == IW_MODE_ADHOC) ? 0 : 1);
mibitem.data = (*mode == IW_MODE_ADHOC) ? 0 : 1;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) if (result)
err = -EFAULT; err = -EFAULT;
exit: exit:
return err; return err;
} }
...@@ -562,9 +564,9 @@ static int p80211wext_siwencode(netdevice_t *dev, ...@@ -562,9 +564,9 @@ static int p80211wext_siwencode(netdevice_t *dev,
/* Set current key number only if no keys are given */ /* Set current key number only if no keys are given */
if (erq->flags & IW_ENCODE_NOKEY) { if (erq->flags & IW_ENCODE_NOKEY) {
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
i); i);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
...@@ -586,7 +588,6 @@ static int p80211wext_siwencode(netdevice_t *dev, ...@@ -586,7 +588,6 @@ static int p80211wext_siwencode(netdevice_t *dev,
-------------------------------------------------------------*/ -------------------------------------------------------------*/
if (erq->length > 0) { if (erq->length > 0) {
/* copy the key from the driver cache as the keys are read-only MIBs */ /* copy the key from the driver cache as the keys are read-only MIBs */
wlandev->wep_keylens[i] = erq->length; wlandev->wep_keylens[i] = erq->length;
memcpy(wlandev->wep_keys[i], key, erq->length); memcpy(wlandev->wep_keys[i], key, erq->length);
...@@ -636,12 +637,12 @@ static int p80211wext_siwencode(netdevice_t *dev, ...@@ -636,12 +637,12 @@ static int p80211wext_siwencode(netdevice_t *dev,
/* Check the PrivacyInvoked flag */ /* Check the PrivacyInvoked flag */
if (erq->flags & IW_ENCODE_DISABLED) { if (erq->flags & IW_ENCODE_DISABLED) {
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
P80211ENUM_truth_false); P80211ENUM_truth_false);
} else { } else {
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
P80211ENUM_truth_true); P80211ENUM_truth_true);
} }
...@@ -660,12 +661,12 @@ static int p80211wext_siwencode(netdevice_t *dev, ...@@ -660,12 +661,12 @@ static int p80211wext_siwencode(netdevice_t *dev,
*/ */
if (erq->flags & IW_ENCODE_RESTRICTED) { if (erq->flags & IW_ENCODE_RESTRICTED) {
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
P80211ENUM_truth_true); P80211ENUM_truth_true);
} else if (erq->flags & IW_ENCODE_OPEN) { } else if (erq->flags & IW_ENCODE_OPEN) {
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
P80211ENUM_truth_false); P80211ENUM_truth_false);
} }
...@@ -767,24 +768,16 @@ static int p80211wext_giwrate(netdevice_t *dev, ...@@ -767,24 +768,16 @@ static int p80211wext_giwrate(netdevice_t *dev,
struct iw_param *rrq, char *extra) struct iw_param *rrq, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
msg.msgcode = DIDmsg_dot11req_mibget; result = p80211wext_getmib(wlandev, DIDmib_p2_p2MAC_p2CurrentTxRate, &value);
memset(&mibitem, 0, sizeof(mibitem));
mibitem.did = DIDmib_p2_p2MAC_p2CurrentTxRate;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem));
rrq->fixed = 0; /* can it change? */ rrq->fixed = 0; /* can it change? */
rrq->disabled = 0; rrq->disabled = 0;
rrq->value = 0; rrq->value = 0;
...@@ -794,7 +787,7 @@ static int p80211wext_giwrate(netdevice_t *dev, ...@@ -794,7 +787,7 @@ static int p80211wext_giwrate(netdevice_t *dev,
#define HFA384x_RATEBIT_5dot5 ((u16)4) #define HFA384x_RATEBIT_5dot5 ((u16)4)
#define HFA384x_RATEBIT_11 ((u16)8) #define HFA384x_RATEBIT_11 ((u16)8)
switch (mibitem.data) { switch (value) {
case HFA384x_RATEBIT_1: case HFA384x_RATEBIT_1:
rrq->value = 1000000; rrq->value = 1000000;
break; break;
...@@ -819,25 +812,19 @@ static int p80211wext_giwrts(netdevice_t *dev, ...@@ -819,25 +812,19 @@ static int p80211wext_giwrts(netdevice_t *dev,
struct iw_param *rts, char *extra) struct iw_param *rts, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
msg.msgcode = DIDmsg_dot11req_mibget; result = p80211wext_getmib(wlandev,
memset(&mibitem, 0, sizeof(mibitem)); DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold; &value);
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); rts->value = value;
rts->value = mibitem.data;
rts->disabled = (rts->value == 2347); rts->disabled = (rts->value == 2347);
rts->fixed = 1; rts->fixed = 1;
...@@ -850,27 +837,23 @@ static int p80211wext_siwrts(netdevice_t *dev, ...@@ -850,27 +837,23 @@ static int p80211wext_siwrts(netdevice_t *dev,
struct iw_param *rts, char *extra) struct iw_param *rts, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
if (!wlan_wext_write) { if (!wlan_wext_write) {
err = (-EOPNOTSUPP); err = -EOPNOTSUPP;
goto exit; goto exit;
} }
msg.msgcode = DIDmsg_dot11req_mibget;
memset(&mibitem, 0, sizeof(mibitem));
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold;
if (rts->disabled) if (rts->disabled)
mibitem.data = 2347; value = 2347;
else else
mibitem.data = rts->value; value = rts->value;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
result = p80211wext_setmib(wlandev,
DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
value);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
...@@ -885,26 +868,19 @@ static int p80211wext_giwfrag(netdevice_t *dev, ...@@ -885,26 +868,19 @@ static int p80211wext_giwfrag(netdevice_t *dev,
struct iw_param *frag, char *extra) struct iw_param *frag, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
msg.msgcode = DIDmsg_dot11req_mibget; result = p80211wext_getmib(wlandev,
memset(&mibitem, 0, sizeof(mibitem)); DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
mibitem.did = &value);
DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); frag->value = value;
frag->value = mibitem.data;
frag->disabled = (frag->value == 2346); frag->disabled = (frag->value == 2346);
frag->fixed = 1; frag->fixed = 1;
...@@ -917,28 +893,23 @@ static int p80211wext_siwfrag(netdevice_t *dev, ...@@ -917,28 +893,23 @@ static int p80211wext_siwfrag(netdevice_t *dev,
struct iw_param *frag, char *extra) struct iw_param *frag, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
int value;
if (!wlan_wext_write) { if (!wlan_wext_write) {
err = (-EOPNOTSUPP); err = (-EOPNOTSUPP);
goto exit; goto exit;
} }
msg.msgcode = DIDmsg_dot11req_mibset;
memset(&mibitem, 0, sizeof(mibitem));
mibitem.did =
DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold;
if (frag->disabled) if (frag->disabled)
mibitem.data = 2346; value = 2346;
else else
mibitem.data = frag->value; value = frag->value;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); result = p80211wext_setmib(wlandev,
result = p80211req_dorequest(wlandev, (u8 *) &msg); DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
value);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
...@@ -962,56 +933,40 @@ static int p80211wext_giwretry(netdevice_t *dev, ...@@ -962,56 +933,40 @@ static int p80211wext_giwretry(netdevice_t *dev,
struct iw_param *rrq, char *extra) struct iw_param *rrq, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
u16 shortretry, longretry, lifetime; u16 shortretry, longretry, lifetime;
unsigned int value;
msg.msgcode = DIDmsg_dot11req_mibget; result = p80211wext_getmib(wlandev,
memset(&mibitem, 0, sizeof(mibitem)); DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit,
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit; &value);
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); shortretry = value;
shortretry = mibitem.data;
mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
result = p80211wext_getmib(wlandev,
DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit,
&value);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); longretry = value;
longretry = mibitem.data;
mibitem.did =
DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
result = p80211wext_getmib(wlandev,
DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime,
&value);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); lifetime = value;
lifetime = mibitem.data;
rrq->disabled = 0; rrq->disabled = 0;
...@@ -1044,8 +999,7 @@ static int p80211wext_siwretry(netdevice_t *dev, ...@@ -1044,8 +999,7 @@ static int p80211wext_siwretry(netdevice_t *dev,
p80211msg_dot11req_mibset_t msg; p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
memset(&mibitem, 0, sizeof(mibitem));
if (!wlan_wext_write) { if (!wlan_wext_write) {
err = (-EOPNOTSUPP); err = (-EOPNOTSUPP);
...@@ -1060,26 +1014,20 @@ static int p80211wext_siwretry(netdevice_t *dev, ...@@ -1060,26 +1014,20 @@ static int p80211wext_siwretry(netdevice_t *dev,
msg.msgcode = DIDmsg_dot11req_mibset; msg.msgcode = DIDmsg_dot11req_mibset;
if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
mibitem.did =
DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime;
mibitem.data = rrq->value /= 1024;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
value = rrq->value /= 1024;
result = p80211wext_setmib(wlandev,
DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime,
value);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
} else { } else {
if (rrq->flags & IW_RETRY_LONG) { if (rrq->flags & IW_RETRY_LONG) {
mibitem.did = result = p80211wext_setmib(wlandev,
DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit; DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit,
mibitem.data = rrq->value; rrq->value);
memcpy(&msg.mibattribute.data, &mibitem,
sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
...@@ -1088,13 +1036,9 @@ static int p80211wext_siwretry(netdevice_t *dev, ...@@ -1088,13 +1036,9 @@ static int p80211wext_siwretry(netdevice_t *dev,
} }
if (rrq->flags & IW_RETRY_SHORT) { if (rrq->flags & IW_RETRY_SHORT) {
mibitem.did = result = p80211wext_setmib(wlandev,
DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit; DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit,
mibitem.data = rrq->value; rrq->value);
memcpy(&msg.mibattribute.data, &mibitem,
sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
...@@ -1117,22 +1061,20 @@ static int p80211wext_siwtxpow(netdevice_t *dev, ...@@ -1117,22 +1061,20 @@ static int p80211wext_siwtxpow(netdevice_t *dev,
p80211msg_dot11req_mibset_t msg; p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
if (!wlan_wext_write) { if (!wlan_wext_write) {
err = (-EOPNOTSUPP); err = (-EOPNOTSUPP);
goto exit; goto exit;
} }
msg.msgcode = DIDmsg_dot11req_mibset;
memset(&mibitem, 0, sizeof(mibitem));
mibitem.did =
DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
if (rrq->fixed == 0) if (rrq->fixed == 0)
mibitem.data = 30; value = 30;
else else
mibitem.data = rrq->value; value = rrq->value;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); result = p80211wext_setmib(wlandev,
result = p80211req_dorequest(wlandev, (u8 *) &msg); DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
value);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
...@@ -1148,33 +1090,25 @@ static int p80211wext_giwtxpow(netdevice_t *dev, ...@@ -1148,33 +1090,25 @@ static int p80211wext_giwtxpow(netdevice_t *dev,
struct iw_param *rrq, char *extra) struct iw_param *rrq, char *extra)
{ {
wlandevice_t *wlandev = dev->ml_priv; wlandevice_t *wlandev = dev->ml_priv;
p80211item_uint32_t mibitem;
p80211msg_dot11req_mibset_t msg;
int result; int result;
int err = 0; int err = 0;
unsigned int value;
msg.msgcode = DIDmsg_dot11req_mibget; result = p80211wext_getmib(wlandev,
DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
memset(&mibitem, 0, sizeof(mibitem)); &value);
mibitem.did =
DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
result = p80211req_dorequest(wlandev, (u8 *) &msg);
if (result) { if (result) {
err = -EFAULT; err = -EFAULT;
goto exit; goto exit;
} }
memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem));
/* XXX handle OFF by setting disabled = 1; */ /* XXX handle OFF by setting disabled = 1; */
rrq->flags = 0; /* IW_TXPOW_DBM; */ rrq->flags = 0; /* IW_TXPOW_DBM; */
rrq->disabled = 0; rrq->disabled = 0;
rrq->fixed = 0; rrq->fixed = 0;
rrq->value = mibitem.data; rrq->value = value;
exit: exit:
return err; return err;
...@@ -1479,7 +1413,7 @@ static int p80211wext_set_encodeext(struct net_device *dev, ...@@ -1479,7 +1413,7 @@ static int p80211wext_set_encodeext(struct net_device *dev,
} }
pr_debug("setting default key (%d)\n", idx); pr_debug("setting default key (%d)\n", idx);
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
idx); idx);
if (result) if (result)
...@@ -1599,12 +1533,12 @@ static int p80211_wext_set_iwauth(struct net_device *dev, ...@@ -1599,12 +1533,12 @@ static int p80211_wext_set_iwauth(struct net_device *dev,
pr_debug("drop_unencrypted %d\n", param->value); pr_debug("drop_unencrypted %d\n", param->value);
if (param->value) if (param->value)
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
P80211ENUM_truth_true); P80211ENUM_truth_true);
else else
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
P80211ENUM_truth_false); P80211ENUM_truth_false);
break; break;
...@@ -1613,12 +1547,12 @@ static int p80211_wext_set_iwauth(struct net_device *dev, ...@@ -1613,12 +1547,12 @@ static int p80211_wext_set_iwauth(struct net_device *dev,
pr_debug("privacy invoked %d\n", param->value); pr_debug("privacy invoked %d\n", param->value);
if (param->value) if (param->value)
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
P80211ENUM_truth_true); P80211ENUM_truth_true);
else else
result = result =
p80211wext_dorequest(wlandev, p80211wext_setmib(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
P80211ENUM_truth_false); P80211ENUM_truth_false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment