aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@gmail.com>2008-08-21 18:27:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-22 19:28:06 -0400
commit4ae6ee2d72e4904909d63c6ebb0240b254b72e85 (patch)
tree5ce5b36b92b31617115b5bb77a7105c909050854 /drivers/net/wireless
parent01632fa4af34addf78ce999eabb4430f33942ee2 (diff)
orinoco: Don't use boolean parameter to record encoding type
For WPA support we need to encode NONE, WEP and TKIP in the encoding parameter. In anticipation of this we need to change the usage away from the current boolean usage. Signed-off-by: David Kilroy <kilroyd@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/orinoco.c31
-rw-r--r--drivers/net/wireless/orinoco.h2
2 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 22718e8176ff..b853ba0cd4e8 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -2100,8 +2100,9 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
2100 int err = 0; 2100 int err = 0;
2101 int master_wep_flag; 2101 int master_wep_flag;
2102 int auth_flag; 2102 int auth_flag;
2103 int enc_flag;
2103 2104
2104 if (priv->wep_on) 2105 if (priv->encode_alg == IW_ENCODE_ALG_WEP)
2105 __orinoco_hw_setup_wepkeys(priv); 2106 __orinoco_hw_setup_wepkeys(priv);
2106 2107
2107 if (priv->wep_restrict) 2108 if (priv->wep_restrict)
@@ -2109,9 +2110,14 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
2109 else 2110 else
2110 auth_flag = HERMES_AUTH_OPEN; 2111 auth_flag = HERMES_AUTH_OPEN;
2111 2112
2113 if (priv->encode_alg == IW_ENCODE_ALG_WEP)
2114 enc_flag = 1;
2115 else
2116 enc_flag = 0;
2117
2112 switch (priv->firmware_type) { 2118 switch (priv->firmware_type) {
2113 case FIRMWARE_TYPE_AGERE: /* Agere style WEP */ 2119 case FIRMWARE_TYPE_AGERE: /* Agere style WEP */
2114 if (priv->wep_on) { 2120 if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
2115 /* Enable the shared-key authentication. */ 2121 /* Enable the shared-key authentication. */
2116 err = hermes_write_wordrec(hw, USER_BAP, 2122 err = hermes_write_wordrec(hw, USER_BAP,
2117 HERMES_RID_CNFAUTHENTICATION_AGERE, 2123 HERMES_RID_CNFAUTHENTICATION_AGERE,
@@ -2119,14 +2125,14 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
2119 } 2125 }
2120 err = hermes_write_wordrec(hw, USER_BAP, 2126 err = hermes_write_wordrec(hw, USER_BAP,
2121 HERMES_RID_CNFWEPENABLED_AGERE, 2127 HERMES_RID_CNFWEPENABLED_AGERE,
2122 priv->wep_on); 2128 enc_flag);
2123 if (err) 2129 if (err)
2124 return err; 2130 return err;
2125 break; 2131 break;
2126 2132
2127 case FIRMWARE_TYPE_INTERSIL: /* Intersil style WEP */ 2133 case FIRMWARE_TYPE_INTERSIL: /* Intersil style WEP */
2128 case FIRMWARE_TYPE_SYMBOL: /* Symbol style WEP */ 2134 case FIRMWARE_TYPE_SYMBOL: /* Symbol style WEP */
2129 if (priv->wep_on) { 2135 if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
2130 if (priv->wep_restrict || 2136 if (priv->wep_restrict ||
2131 (priv->firmware_type == FIRMWARE_TYPE_SYMBOL)) 2137 (priv->firmware_type == FIRMWARE_TYPE_SYMBOL))
2132 master_wep_flag = HERMES_WEP_PRIVACY_INVOKED | 2138 master_wep_flag = HERMES_WEP_PRIVACY_INVOKED |
@@ -3008,7 +3014,7 @@ static int orinoco_init(struct net_device *dev)
3008 priv->channel = 0; /* use firmware default */ 3014 priv->channel = 0; /* use firmware default */
3009 3015
3010 priv->promiscuous = 0; 3016 priv->promiscuous = 0;
3011 priv->wep_on = 0; 3017 priv->encode_alg = IW_ENCODE_ALG_NONE;
3012 priv->tx_key = 0; 3018 priv->tx_key = 0;
3013 3019
3014 /* Make the hardware available, as long as it hasn't been 3020 /* Make the hardware available, as long as it hasn't been
@@ -3497,7 +3503,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
3497 struct orinoco_private *priv = netdev_priv(dev); 3503 struct orinoco_private *priv = netdev_priv(dev);
3498 int index = (erq->flags & IW_ENCODE_INDEX) - 1; 3504 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
3499 int setindex = priv->tx_key; 3505 int setindex = priv->tx_key;
3500 int enable = priv->wep_on; 3506 int encode_alg = priv->encode_alg;
3501 int restricted = priv->wep_restrict; 3507 int restricted = priv->wep_restrict;
3502 u16 xlen = 0; 3508 u16 xlen = 0;
3503 int err = -EINPROGRESS; /* Call commit handler */ 3509 int err = -EINPROGRESS; /* Call commit handler */
@@ -3531,9 +3537,9 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
3531 xlen = 0; 3537 xlen = 0;
3532 3538
3533 /* Switch on WEP if off */ 3539 /* Switch on WEP if off */
3534 if ((!enable) && (xlen > 0)) { 3540 if ((encode_alg != IW_ENCODE_ALG_WEP) && (xlen > 0)) {
3535 setindex = index; 3541 setindex = index;
3536 enable = 1; 3542 encode_alg = IW_ENCODE_ALG_WEP;
3537 } 3543 }
3538 } else { 3544 } else {
3539 /* Important note : if the user do "iwconfig eth0 enc off", 3545 /* Important note : if the user do "iwconfig eth0 enc off",
@@ -3555,7 +3561,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
3555 } 3561 }
3556 3562
3557 if (erq->flags & IW_ENCODE_DISABLED) 3563 if (erq->flags & IW_ENCODE_DISABLED)
3558 enable = 0; 3564 encode_alg = IW_ENCODE_ALG_NONE;
3559 if (erq->flags & IW_ENCODE_OPEN) 3565 if (erq->flags & IW_ENCODE_OPEN)
3560 restricted = 0; 3566 restricted = 0;
3561 if (erq->flags & IW_ENCODE_RESTRICTED) 3567 if (erq->flags & IW_ENCODE_RESTRICTED)
@@ -3570,14 +3576,15 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
3570 priv->tx_key = setindex; 3576 priv->tx_key = setindex;
3571 3577
3572 /* Try fast key change if connected and only keys are changed */ 3578 /* Try fast key change if connected and only keys are changed */
3573 if (priv->wep_on && enable && (priv->wep_restrict == restricted) && 3579 if ((priv->encode_alg == encode_alg) &&
3580 (priv->wep_restrict == restricted) &&
3574 netif_carrier_ok(dev)) { 3581 netif_carrier_ok(dev)) {
3575 err = __orinoco_hw_setup_wepkeys(priv); 3582 err = __orinoco_hw_setup_wepkeys(priv);
3576 /* No need to commit if successful */ 3583 /* No need to commit if successful */
3577 goto out; 3584 goto out;
3578 } 3585 }
3579 3586
3580 priv->wep_on = enable; 3587 priv->encode_alg = encode_alg;
3581 priv->wep_restrict = restricted; 3588 priv->wep_restrict = restricted;
3582 3589
3583 out: 3590 out:
@@ -3606,7 +3613,7 @@ static int orinoco_ioctl_getiwencode(struct net_device *dev,
3606 index = priv->tx_key; 3613 index = priv->tx_key;
3607 3614
3608 erq->flags = 0; 3615 erq->flags = 0;
3609 if (! priv->wep_on) 3616 if (!priv->encode_alg)
3610 erq->flags |= IW_ENCODE_DISABLED; 3617 erq->flags |= IW_ENCODE_DISABLED;
3611 erq->flags |= index + 1; 3618 erq->flags |= index + 1;
3612 3619
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index f510994ea9fe..5605fd30b81d 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -100,7 +100,7 @@ struct orinoco_private {
100 /* Configuration paramaters */ 100 /* Configuration paramaters */
101 u32 iw_mode; 101 u32 iw_mode;
102 int prefer_port3; 102 int prefer_port3;
103 u16 wep_on, wep_restrict, tx_key; 103 u16 encode_alg, wep_restrict, tx_key;
104 struct orinoco_key keys[ORINOCO_MAX_KEYS]; 104 struct orinoco_key keys[ORINOCO_MAX_KEYS];
105 int bitratemode; 105 int bitratemode;
106 char nick[IW_ESSID_MAX_SIZE+1]; 106 char nick[IW_ESSID_MAX_SIZE+1];