From: kilroyd@googlemail.com
To: linux-wireless@vger.kernel.org
Cc: proski@gnu.org, orinoco-devel@lists.sourceforge.net,
David Kilroy <kilroyd@gmail.com>
Subject: [RFC PATCH 13/19] orinoco: Don't use boolean parameter to record encoding type
Date: Sat, 28 Jun 2008 19:38:19 +0100 [thread overview]
Message-ID: <1214678305-7057-14-git-send-email-kilroyd@gmail.com> (raw)
In-Reply-To: <1214678305-7057-13-git-send-email-kilroyd@gmail.com>
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>
---
drivers/net/wireless/orinoco.c | 31 +++++++++++++++++++------------
drivers/net/wireless/orinoco.h | 2 +-
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index b31e485..2cd144e 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)
int err = 0;
int master_wep_flag;
int auth_flag;
+ int enc_flag;
- if (priv->wep_on)
+ if (priv->encode_alg == IW_ENCODE_ALG_WEP)
__orinoco_hw_setup_wepkeys(priv);
if (priv->wep_restrict)
@@ -2109,9 +2110,14 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
else
auth_flag = HERMES_AUTH_OPEN;
+ if (priv->encode_alg == IW_ENCODE_ALG_WEP)
+ enc_flag = 1;
+ else
+ enc_flag = 0;
+
switch (priv->firmware_type) {
case FIRMWARE_TYPE_AGERE: /* Agere style WEP */
- if (priv->wep_on) {
+ if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
/* Enable the shared-key authentication. */
err = hermes_write_wordrec(hw, USER_BAP,
HERMES_RID_CNFAUTHENTICATION_AGERE,
@@ -2119,14 +2125,14 @@ static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
}
err = hermes_write_wordrec(hw, USER_BAP,
HERMES_RID_CNFWEPENABLED_AGERE,
- priv->wep_on);
+ enc_flag);
if (err)
return err;
break;
case FIRMWARE_TYPE_INTERSIL: /* Intersil style WEP */
case FIRMWARE_TYPE_SYMBOL: /* Symbol style WEP */
- if (priv->wep_on) {
+ if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
if (priv->wep_restrict ||
(priv->firmware_type == FIRMWARE_TYPE_SYMBOL))
master_wep_flag = HERMES_WEP_PRIVACY_INVOKED |
@@ -3001,7 +3007,7 @@ static int orinoco_init(struct net_device *dev)
priv->channel = 0; /* use firmware default */
priv->promiscuous = 0;
- priv->wep_on = 0;
+ priv->encode_alg = IW_ENCODE_ALG_NONE;
priv->tx_key = 0;
/* Make the hardware available, as long as it hasn't been
@@ -3490,7 +3496,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
struct orinoco_private *priv = netdev_priv(dev);
int index = (erq->flags & IW_ENCODE_INDEX) - 1;
int setindex = priv->tx_key;
- int enable = priv->wep_on;
+ int encode_alg = priv->encode_alg;
int restricted = priv->wep_restrict;
u16 xlen = 0;
int err = -EINPROGRESS; /* Call commit handler */
@@ -3524,9 +3530,9 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
xlen = 0;
/* Switch on WEP if off */
- if ((!enable) && (xlen > 0)) {
+ if ((encode_alg != IW_ENCODE_ALG_WEP) && (xlen > 0)) {
setindex = index;
- enable = 1;
+ encode_alg = IW_ENCODE_ALG_WEP;
}
} else {
/* Important note : if the user do "iwconfig eth0 enc off",
@@ -3548,7 +3554,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
}
if (erq->flags & IW_ENCODE_DISABLED)
- enable = 0;
+ encode_alg = IW_ENCODE_ALG_NONE;
if (erq->flags & IW_ENCODE_OPEN)
restricted = 0;
if (erq->flags & IW_ENCODE_RESTRICTED)
@@ -3563,14 +3569,15 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
priv->tx_key = setindex;
/* Try fast key change if connected and only keys are changed */
- if (priv->wep_on && enable && (priv->wep_restrict == restricted) &&
+ if ((priv->encode_alg == encode_alg) &&
+ (priv->wep_restrict == restricted) &&
netif_carrier_ok(dev)) {
err = __orinoco_hw_setup_wepkeys(priv);
/* No need to commit if successful */
goto out;
}
- priv->wep_on = enable;
+ priv->encode_alg = encode_alg;
priv->wep_restrict = restricted;
out:
@@ -3599,7 +3606,7 @@ static int orinoco_ioctl_getiwencode(struct net_device *dev,
index = priv->tx_key;
erq->flags = 0;
- if (! priv->wep_on)
+ if (!priv->encode_alg)
erq->flags |= IW_ENCODE_DISABLED;
erq->flags |= index + 1;
diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
index f510994..5605fd3 100644
--- a/drivers/net/wireless/orinoco.h
+++ b/drivers/net/wireless/orinoco.h
@@ -100,7 +100,7 @@ struct orinoco_private {
/* Configuration paramaters */
u32 iw_mode;
int prefer_port3;
- u16 wep_on, wep_restrict, tx_key;
+ u16 encode_alg, wep_restrict, tx_key;
struct orinoco_key keys[ORINOCO_MAX_KEYS];
int bitratemode;
char nick[IW_ESSID_MAX_SIZE+1];
--
1.5.4.5
next prev parent reply other threads:[~2008-06-28 18:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-28 18:38 [RFC PATCH 00/19] orinoco: WPA for Agere based cards kilroyd
2008-06-28 18:38 ` [RFC PATCH 01/19] orinoco: Add ESSID specific scanning for Agere fw kilroyd
2008-06-28 18:38 ` [RFC PATCH 02/19] orinoco: Update scan translation kilroyd
2008-06-28 18:38 ` [RFC PATCH 03/19] orinoco: Specify all three parameters to every Hermes command kilroyd
2008-06-28 18:38 ` [RFC PATCH 04/19] orinoco: Move EXPORT_SYMBOL declarations next to exported function kilroyd
2008-06-28 18:38 ` [RFC PATCH 05/19] orinoco: Add function to execute Hermes initialisation commands synchronously kilroyd
2008-06-28 18:38 ` [RFC PATCH 06/19] orinoco: Move firmware download functionality into new module kilroyd
2008-06-28 18:38 ` [RFC PATCH 07/19] orinoco: Make firmware download logic more generic kilroyd
2008-06-28 18:38 ` [RFC PATCH 08/19] orinoco: Extend hermes_dld routines for Agere firmware kilroyd
2008-06-28 18:38 ` [RFC PATCH 09/19] orinoco: Invoke firmware download in main driver kilroyd
2008-06-28 18:38 ` [RFC PATCH 10/19] orinoco: Fix transmit for Agere/Lucent with fw 9.x kilroyd
2008-06-28 18:38 ` [RFC PATCH 11/19] orinoco: address checkpatch typedef warning kilroyd
2008-06-28 18:38 ` [RFC PATCH 12/19] orinoco: Use extended Agere scans available on 9.x series firmwares kilroyd
2008-06-28 18:38 ` kilroyd [this message]
2008-06-28 18:38 ` [RFC PATCH 14/19] orinoco: Split wevent work thread from wevent sending kilroyd
2008-06-28 18:38 ` [RFC PATCH 15/19] orinoco: Use a macro to define wireless handlers kilroyd
2008-06-28 18:38 ` [RFC PATCH 16/19] orinoco: Add WE-18 ioctls for WPA kilroyd
2008-06-28 18:38 ` [RFC PATCH 17/19] orinoco: Send association events to userspace kilroyd
2008-06-28 18:38 ` [RFC PATCH 18/19] orinoco: Process bulk of receive interrupt in a tasklet kilroyd
2008-06-28 18:38 ` [RFC PATCH 19/19] orinoco: Add MIC on TX and check on RX kilroyd
2008-06-29 21:56 ` Harvey Harrison
2008-06-30 11:06 ` Johannes Berg
2008-06-30 18:09 ` Dave
2008-06-30 19:28 ` [RFC PATCH 00/19] orinoco: WPA for Agere based cards John W. Linville
2008-06-30 20:16 ` Dave
2008-08-01 23:49 ` [Orinoco-devel] " Pavel Roskin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1214678305-7057-14-git-send-email-kilroyd@gmail.com \
--to=kilroyd@googlemail.com \
--cc=kilroyd@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=orinoco-devel@lists.sourceforge.net \
--cc=proski@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).