* [PATCH] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
@ 2008-04-17 15:28 Ivo van Doorn
2008-04-17 15:29 ` Michael Buesch
2008-04-17 15:59 ` [PATCH v2] " Ivo van Doorn
0 siblings, 2 replies; 10+ messages in thread
From: Ivo van Doorn @ 2008-04-17 15:28 UTC (permalink / raw)
To: John W. Linville
Cc: linux-wireless, Johannes Berg, Jiri Slaby, Michael Buesch,
Larry Finger, Zhu Yi
The hw_key_idx inside the ieee80211_key_conf structure does
not provide all the information drivers might need to perform
hardware encryption.
This is in particular true for rt2x00 who needs to know the
key algorithm and whether it is a shared or pairwise key.
By passing the ieee80211_key_conf pointer it assures us that
drivers can make full use of all information that it should know
about a particular key.
Additionally this patch updates all drivers to grab the hw_key_idx from
the ieee80211_key_conf structure.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index e18305b..cd20abe 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1323,7 +1323,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
pktlen = skb->len;
if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
- keyidx = ctl->key_idx;
+ keyidx = ctl->hw_key->hw_key_idx;
pktlen += ctl->icv_len;
}
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 19aefbf..2ee19cf 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -235,7 +235,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
plcp_fragment_len = fragment_len + FCS_LEN;
if (use_encryption) {
- u8 key_idx = (u16) (txctl->key_idx);
+ u8 key_idx = (u16) (txctl->hw_key->hw_key_idx);
struct b43_key *key;
int wlhdr_len;
size_t iv_len;
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index dcad249..ba50b68 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -232,7 +232,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
plcp_fragment_len = fragment_len + FCS_LEN;
if (use_encryption) {
- u8 key_idx = (u16)(txctl->key_idx);
+ u8 key_idx = (u16)(txctl->hw_key->hw_key_idx);
struct b43legacy_key *key;
int wlhdr_len;
size_t iv_len;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 1a5678f..b1250ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2391,7 +2391,8 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
struct sk_buff *skb_frag,
int last_frag)
{
- struct iwl3945_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo;
+ struct iwl3945_hw_key *keyinfo =
+ &priv->stations[ctl->hw_key->hw_key_idx].keyinfo;
switch (keyinfo->alg) {
case ALG_CCMP:
@@ -2414,7 +2415,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
case ALG_WEP:
cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP |
- (ctl->key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
+ (ctl->hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
if (keyinfo->keylen == 13)
cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
@@ -2422,7 +2423,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen);
IWL_DEBUG_TX("Configuring packet for WEP encryption "
- "with key %d\n", ctl->key_idx);
+ "with key %d\n", ctl->hw_key->hw_key_idx);
break;
default:
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index d7e2358..ae74042 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1936,7 +1936,7 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
struct iwl_wep_key *wepkey;
int keyidx = 0;
- BUG_ON(ctl->key_idx > 3);
+ BUG_ON(ctl->hw_key->hw_key_idx > 3);
switch (keyinfo->alg) {
case ALG_CCMP:
@@ -1955,11 +1955,11 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
break;
case ALG_WEP:
- wepkey = &priv->wep_keys[ctl->key_idx];
+ wepkey = &priv->wep_keys[ctl->hw_key->hw_key_idx];
cmd->cmd.tx.sec_ctl = 0;
if (priv->default_wep_key) {
/* the WEP key was sent as static */
- keyidx = ctl->key_idx;
+ keyidx = ctl->hw_key->hw_key_idx;
memcpy(&cmd->cmd.tx.key[3], wepkey->key,
wepkey->key_size);
if (wepkey->key_size == WEP_KEY_LEN_128)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4a80d74..af692f4 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -298,9 +298,11 @@ struct ieee80211_tx_control {
/* retry rate for the last retries */
struct ieee80211_rate *alt_retry_rate;
+ /* Key used for hardware encryption
+ * undefined if IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
+ struct ieee80211_key_conf *hw_key;
+
u32 flags; /* tx control flags defined above */
- u8 key_idx; /* keyidx from hw->set_key(), undefined if
- * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
u8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
* This could be used when set_retry_limit
* is not implemented by the driver */
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index affcecd..3cbae42 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -337,7 +337,7 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
return -1;
} else {
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
return -1;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 45709ad..42f3654 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -228,7 +228,7 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx,
0x7f),
(u8) key->u.tkip.iv16);
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return 0;
}
@@ -256,7 +256,7 @@ ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
!wpa_test) {
/* hwaccel - with no need for preallocated room for IV/ICV */
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return TX_CONTINUE;
}
@@ -478,7 +478,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx,
if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
/* hwaccel - with preallocated room for CCMP header */
- tx->control->key_idx = key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return 0;
}
@@ -505,7 +505,7 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
/* hwaccel - with no need for preallocated room for CCMP "
* header or MIC fields */
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return TX_CONTINUE;
}
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 15:28 [PATCH] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf Ivo van Doorn
@ 2008-04-17 15:29 ` Michael Buesch
2008-04-17 15:56 ` Ivo van Doorn
2008-04-17 15:59 ` [PATCH v2] " Ivo van Doorn
1 sibling, 1 reply; 10+ messages in thread
From: Michael Buesch @ 2008-04-17 15:29 UTC (permalink / raw)
To: Ivo van Doorn
Cc: John W. Linville, linux-wireless, Johannes Berg, Jiri Slaby,
Larry Finger, Zhu Yi
On Thursday 17 April 2008 17:28:29 Ivo van Doorn wrote:
> diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
> index 19aefbf..2ee19cf 100644
> --- a/drivers/net/wireless/b43/xmit.c
> +++ b/drivers/net/wireless/b43/xmit.c
> @@ -235,7 +235,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
>
> plcp_fragment_len = fragment_len + FCS_LEN;
> if (use_encryption) {
> - u8 key_idx = (u16) (txctl->key_idx);
> + u8 key_idx = (u16) (txctl->hw_key->hw_key_idx);
Can we actually remove that bogus cast while we are at it? :)
> struct b43_key *key;
> int wlhdr_len;
> size_t iv_len;
> diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
> index dcad249..ba50b68 100644
> --- a/drivers/net/wireless/b43legacy/xmit.c
> +++ b/drivers/net/wireless/b43legacy/xmit.c
> @@ -232,7 +232,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
>
> plcp_fragment_len = fragment_len + FCS_LEN;
> if (use_encryption) {
> - u8 key_idx = (u16)(txctl->key_idx);
> + u8 key_idx = (u16)(txctl->hw_key->hw_key_idx);
Same here.
--
Greetings Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 15:29 ` Michael Buesch
@ 2008-04-17 15:56 ` Ivo van Doorn
0 siblings, 0 replies; 10+ messages in thread
From: Ivo van Doorn @ 2008-04-17 15:56 UTC (permalink / raw)
To: Michael Buesch
Cc: John W. Linville, linux-wireless, Johannes Berg, Jiri Slaby,
Larry Finger, Zhu Yi
On Thursday 17 April 2008, Michael Buesch wrote:
> On Thursday 17 April 2008 17:28:29 Ivo van Doorn wrote:
> > diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
> > index 19aefbf..2ee19cf 100644
> > --- a/drivers/net/wireless/b43/xmit.c
> > +++ b/drivers/net/wireless/b43/xmit.c
> > @@ -235,7 +235,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
> >
> > plcp_fragment_len = fragment_len + FCS_LEN;
> > if (use_encryption) {
> > - u8 key_idx = (u16) (txctl->key_idx);
> > + u8 key_idx = (u16) (txctl->hw_key->hw_key_idx);
>
> Can we actually remove that bogus cast while we are at it? :)
>
> > struct b43_key *key;
> > int wlhdr_len;
> > size_t iv_len;
> > diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
> > index dcad249..ba50b68 100644
> > --- a/drivers/net/wireless/b43legacy/xmit.c
> > +++ b/drivers/net/wireless/b43legacy/xmit.c
> > @@ -232,7 +232,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
> >
> > plcp_fragment_len = fragment_len + FCS_LEN;
> > if (use_encryption) {
> > - u8 key_idx = (u16)(txctl->key_idx);
> > + u8 key_idx = (u16)(txctl->hw_key->hw_key_idx);
>
> Same here.
Sure, updated patch on its way. :)
Ivo
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 15:28 [PATCH] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf Ivo van Doorn
2008-04-17 15:29 ` Michael Buesch
@ 2008-04-17 15:59 ` Ivo van Doorn
2008-04-17 16:54 ` Johannes Berg
2008-04-17 17:23 ` [PATCH v3] " Ivo van Doorn
1 sibling, 2 replies; 10+ messages in thread
From: Ivo van Doorn @ 2008-04-17 15:59 UTC (permalink / raw)
To: John W. Linville
Cc: linux-wireless, Johannes Berg, Jiri Slaby, Michael Buesch,
Larry Finger, Zhu Yi
The hw_key_idx inside the ieee80211_key_conf structure does
not provide all the information drivers might need to perform
hardware encryption.
This is in particular true for rt2x00 who needs to know the
key algorithm and whether it is a shared or pairwise key.
By passing the ieee80211_key_conf pointer it assures us that
drivers can make full use of all information that it should know
about a particular key.
Additionally this patch updates all drivers to grab the hw_key_idx from
the ieee80211_key_conf structure.
v2: Removed bogus u16 cast
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index e18305b..cd20abe 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1323,7 +1323,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
pktlen = skb->len;
if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
- keyidx = ctl->key_idx;
+ keyidx = ctl->hw_key->hw_key_idx;
pktlen += ctl->icv_len;
}
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 19aefbf..8849194 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -235,7 +235,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
plcp_fragment_len = fragment_len + FCS_LEN;
if (use_encryption) {
- u8 key_idx = (u16) (txctl->key_idx);
+ u8 key_idx = txctl->hw_key->hw_key_idx;
struct b43_key *key;
int wlhdr_len;
size_t iv_len;
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index dcad249..fc83dab 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -232,7 +232,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
plcp_fragment_len = fragment_len + FCS_LEN;
if (use_encryption) {
- u8 key_idx = (u16)(txctl->key_idx);
+ u8 key_idx = txctl->hw_key->hw_key_idx;
struct b43legacy_key *key;
int wlhdr_len;
size_t iv_len;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 1a5678f..b1250ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2391,7 +2391,8 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
struct sk_buff *skb_frag,
int last_frag)
{
- struct iwl3945_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo;
+ struct iwl3945_hw_key *keyinfo =
+ &priv->stations[ctl->hw_key->hw_key_idx].keyinfo;
switch (keyinfo->alg) {
case ALG_CCMP:
@@ -2414,7 +2415,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
case ALG_WEP:
cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP |
- (ctl->key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
+ (ctl->hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
if (keyinfo->keylen == 13)
cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
@@ -2422,7 +2423,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen);
IWL_DEBUG_TX("Configuring packet for WEP encryption "
- "with key %d\n", ctl->key_idx);
+ "with key %d\n", ctl->hw_key->hw_key_idx);
break;
default:
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index d7e2358..ae74042 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1936,7 +1936,7 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
struct iwl_wep_key *wepkey;
int keyidx = 0;
- BUG_ON(ctl->key_idx > 3);
+ BUG_ON(ctl->hw_key->hw_key_idx > 3);
switch (keyinfo->alg) {
case ALG_CCMP:
@@ -1955,11 +1955,11 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
break;
case ALG_WEP:
- wepkey = &priv->wep_keys[ctl->key_idx];
+ wepkey = &priv->wep_keys[ctl->hw_key->hw_key_idx];
cmd->cmd.tx.sec_ctl = 0;
if (priv->default_wep_key) {
/* the WEP key was sent as static */
- keyidx = ctl->key_idx;
+ keyidx = ctl->hw_key->hw_key_idx;
memcpy(&cmd->cmd.tx.key[3], wepkey->key,
wepkey->key_size);
if (wepkey->key_size == WEP_KEY_LEN_128)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4a80d74..af692f4 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -298,9 +298,11 @@ struct ieee80211_tx_control {
/* retry rate for the last retries */
struct ieee80211_rate *alt_retry_rate;
+ /* Key used for hardware encryption
+ * undefined if IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
+ struct ieee80211_key_conf *hw_key;
+
u32 flags; /* tx control flags defined above */
- u8 key_idx; /* keyidx from hw->set_key(), undefined if
- * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
u8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
* This could be used when set_retry_limit
* is not implemented by the driver */
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index affcecd..3cbae42 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -337,7 +337,7 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
return -1;
} else {
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
return -1;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 45709ad..42f3654 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -228,7 +228,7 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx,
0x7f),
(u8) key->u.tkip.iv16);
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return 0;
}
@@ -256,7 +256,7 @@ ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
!wpa_test) {
/* hwaccel - with no need for preallocated room for IV/ICV */
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return TX_CONTINUE;
}
@@ -478,7 +478,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx,
if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
/* hwaccel - with preallocated room for CCMP header */
- tx->control->key_idx = key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return 0;
}
@@ -505,7 +505,7 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
/* hwaccel - with no need for preallocated room for CCMP "
* header or MIC fields */
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return TX_CONTINUE;
}
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v2] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 15:59 ` [PATCH v2] " Ivo van Doorn
@ 2008-04-17 16:54 ` Johannes Berg
2008-04-17 17:23 ` [PATCH v3] " Ivo van Doorn
1 sibling, 0 replies; 10+ messages in thread
From: Johannes Berg @ 2008-04-17 16:54 UTC (permalink / raw)
To: Ivo van Doorn
Cc: John W. Linville, linux-wireless, Jiri Slaby, Michael Buesch,
Larry Finger, Zhu Yi
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
>
> + /* Key used for hardware encryption
> + * undefined if IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
> + struct ieee80211_key_conf *hw_key;
I would prefer "NULL if <flag> is set". And we could possibly do some
internal rework to get rid of the flag now (don't do that right now
unless you think it's easy, I'm not too sure off-hand). Can you also add
a comment about what I said wrt. accessing it inside ops->tx() only?
Sorry about the mail crossing.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 15:59 ` [PATCH v2] " Ivo van Doorn
2008-04-17 16:54 ` Johannes Berg
@ 2008-04-17 17:23 ` Ivo van Doorn
2008-04-17 17:26 ` Johannes Berg
2008-04-17 17:41 ` [PATCH v4] " Ivo van Doorn
1 sibling, 2 replies; 10+ messages in thread
From: Ivo van Doorn @ 2008-04-17 17:23 UTC (permalink / raw)
To: John W. Linville
Cc: linux-wireless, Johannes Berg, Jiri Slaby, Michael Buesch,
Larry Finger, Zhu Yi
The hw_key_idx inside the ieee80211_key_conf structure does
not provide all the information drivers might need to perform
hardware encryption.
This is in particular true for rt2x00 who needs to know the
key algorithm and whether it is a shared or pairwise key.
By passing the ieee80211_key_conf pointer it assures us that
drivers can make full use of all information that it should know
about a particular key.
Additionally this patch updates all drivers to grab the hw_key_idx from
the ieee80211_key_conf structure.
v2: Removed bogus u16 cast
v3: Add warning about ieee80211_tx_control pointers
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index e18305b..cd20abe 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1323,7 +1323,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
pktlen = skb->len;
if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
- keyidx = ctl->key_idx;
+ keyidx = ctl->hw_key->hw_key_idx;
pktlen += ctl->icv_len;
}
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 19aefbf..8849194 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -235,7 +235,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
plcp_fragment_len = fragment_len + FCS_LEN;
if (use_encryption) {
- u8 key_idx = (u16) (txctl->key_idx);
+ u8 key_idx = txctl->hw_key->hw_key_idx;
struct b43_key *key;
int wlhdr_len;
size_t iv_len;
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index dcad249..fc83dab 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -232,7 +232,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
plcp_fragment_len = fragment_len + FCS_LEN;
if (use_encryption) {
- u8 key_idx = (u16)(txctl->key_idx);
+ u8 key_idx = txctl->hw_key->hw_key_idx;
struct b43legacy_key *key;
int wlhdr_len;
size_t iv_len;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 1a5678f..b1250ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2391,7 +2391,8 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
struct sk_buff *skb_frag,
int last_frag)
{
- struct iwl3945_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo;
+ struct iwl3945_hw_key *keyinfo =
+ &priv->stations[ctl->hw_key->hw_key_idx].keyinfo;
switch (keyinfo->alg) {
case ALG_CCMP:
@@ -2414,7 +2415,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
case ALG_WEP:
cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP |
- (ctl->key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
+ (ctl->hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
if (keyinfo->keylen == 13)
cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
@@ -2422,7 +2423,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen);
IWL_DEBUG_TX("Configuring packet for WEP encryption "
- "with key %d\n", ctl->key_idx);
+ "with key %d\n", ctl->hw_key->hw_key_idx);
break;
default:
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index d7e2358..ae74042 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1936,7 +1936,7 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
struct iwl_wep_key *wepkey;
int keyidx = 0;
- BUG_ON(ctl->key_idx > 3);
+ BUG_ON(ctl->hw_key->hw_key_idx > 3);
switch (keyinfo->alg) {
case ALG_CCMP:
@@ -1955,11 +1955,11 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
break;
case ALG_WEP:
- wepkey = &priv->wep_keys[ctl->key_idx];
+ wepkey = &priv->wep_keys[ctl->hw_key->hw_key_idx];
cmd->cmd.tx.sec_ctl = 0;
if (priv->default_wep_key) {
/* the WEP key was sent as static */
- keyidx = ctl->key_idx;
+ keyidx = ctl->hw_key->hw_key_idx;
memcpy(&cmd->cmd.tx.key[3], wepkey->key,
wepkey->key_size);
if (wepkey->key_size == WEP_KEY_LEN_128)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4a80d74..28a8893 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -286,8 +286,13 @@ enum mac80211_tx_control_flags {
/* Transmit control fields. This data structure is passed to low-level driver
* with each TX frame. The low-level driver is responsible for configuring
- * the hardware to use given values (depending on what is supported). */
-
+ * the hardware to use given values (depending on what is supported).
+ *
+ * NOTE: All pointers within this structure are only valid until
+ * ieee80211_ops->tx() returns. If the information is required
+ * at a later time (i.e. when defering the work to a workqueue)
+ * make sure that not only the contents of struct ieee80211_tx_control
+ * is copied, but also the data where the pointers refer to. */
struct ieee80211_tx_control {
struct ieee80211_vif *vif;
struct ieee80211_rate *tx_rate;
@@ -298,9 +303,11 @@ struct ieee80211_tx_control {
/* retry rate for the last retries */
struct ieee80211_rate *alt_retry_rate;
+ /* Key used for hardware encryption
+ * NULL if IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
+ struct ieee80211_key_conf *hw_key;
+
u32 flags; /* tx control flags defined above */
- u8 key_idx; /* keyidx from hw->set_key(), undefined if
- * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
u8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
* This could be used when set_retry_limit
* is not implemented by the driver */
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index affcecd..3cbae42 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -337,7 +337,7 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
return -1;
} else {
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
return -1;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 45709ad..42f3654 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -228,7 +228,7 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx,
0x7f),
(u8) key->u.tkip.iv16);
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return 0;
}
@@ -256,7 +256,7 @@ ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
!wpa_test) {
/* hwaccel - with no need for preallocated room for IV/ICV */
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return TX_CONTINUE;
}
@@ -478,7 +478,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx,
if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
/* hwaccel - with preallocated room for CCMP header */
- tx->control->key_idx = key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return 0;
}
@@ -505,7 +505,7 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
/* hwaccel - with no need for preallocated room for CCMP "
* header or MIC fields */
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return TX_CONTINUE;
}
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v3] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 17:23 ` [PATCH v3] " Ivo van Doorn
@ 2008-04-17 17:26 ` Johannes Berg
2008-04-17 17:41 ` [PATCH v4] " Ivo van Doorn
1 sibling, 0 replies; 10+ messages in thread
From: Johannes Berg @ 2008-04-17 17:26 UTC (permalink / raw)
To: Ivo van Doorn
Cc: John W. Linville, linux-wireless, Jiri Slaby, Michael Buesch,
Larry Finger, Zhu Yi
[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]
Hi,
I hate to do this, but
> /* Transmit control fields. This data structure is passed to low-level driver
> * with each TX frame. The low-level driver is responsible for configuring
> - * the hardware to use given values (depending on what is supported). */
> -
> + * the hardware to use given values (depending on what is supported).
> + *
> + * NOTE: All pointers within this structure are only valid until
> + * ieee80211_ops->tx() returns. If the information is required
> + * at a later time (i.e. when defering the work to a workqueue)
> + * make sure that not only the contents of struct ieee80211_tx_control
> + * is copied, but also the data where the pointers refer to. */
This isn't true for all pointers, the rate pointers point into the array
rate array so they're valid until the phy is unregistered, the vif
pointer is valid until the interface is removed via the appropriate
callback (remove_interface? I forgot), and the key until that is removed
via set_key().
Maybe we should add that instead? Normally, people will not need the
pointers outside ->tx() though, of course.
Also, please move the */ to a new line while you're at it anyway.
Other than that,
Acked-by: Johannes Berg <johannes@sipsolutions.net>
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v4] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 17:23 ` [PATCH v3] " Ivo van Doorn
2008-04-17 17:26 ` Johannes Berg
@ 2008-04-17 17:41 ` Ivo van Doorn
2008-04-17 22:02 ` Johannes Berg
1 sibling, 1 reply; 10+ messages in thread
From: Ivo van Doorn @ 2008-04-17 17:41 UTC (permalink / raw)
To: John W. Linville
Cc: linux-wireless, Johannes Berg, Jiri Slaby, Michael Buesch,
Larry Finger, Zhu Yi
The hw_key_idx inside the ieee80211_key_conf structure does
not provide all the information drivers might need to perform
hardware encryption.
This is in particular true for rt2x00 who needs to know the
key algorithm and whether it is a shared or pairwise key.
By passing the ieee80211_key_conf pointer it assures us that
drivers can make full use of all information that it should know
about a particular key.
Additionally this patch updates all drivers to grab the hw_key_idx from
the ieee80211_key_conf structure.
v2: Removed bogus u16 cast
v3: Add warning about ieee80211_tx_control pointers
v4: Update warning about ieee80211_tx_control pointers
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
---
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index e18305b..cd20abe 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1323,7 +1323,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
pktlen = skb->len;
if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
- keyidx = ctl->key_idx;
+ keyidx = ctl->hw_key->hw_key_idx;
pktlen += ctl->icv_len;
}
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 19aefbf..8849194 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -235,7 +235,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
plcp_fragment_len = fragment_len + FCS_LEN;
if (use_encryption) {
- u8 key_idx = (u16) (txctl->key_idx);
+ u8 key_idx = txctl->hw_key->hw_key_idx;
struct b43_key *key;
int wlhdr_len;
size_t iv_len;
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index dcad249..fc83dab 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -232,7 +232,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
plcp_fragment_len = fragment_len + FCS_LEN;
if (use_encryption) {
- u8 key_idx = (u16)(txctl->key_idx);
+ u8 key_idx = txctl->hw_key->hw_key_idx;
struct b43legacy_key *key;
int wlhdr_len;
size_t iv_len;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 1a5678f..b1250ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2391,7 +2391,8 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
struct sk_buff *skb_frag,
int last_frag)
{
- struct iwl3945_hw_key *keyinfo = &priv->stations[ctl->key_idx].keyinfo;
+ struct iwl3945_hw_key *keyinfo =
+ &priv->stations[ctl->hw_key->hw_key_idx].keyinfo;
switch (keyinfo->alg) {
case ALG_CCMP:
@@ -2414,7 +2415,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
case ALG_WEP:
cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP |
- (ctl->key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
+ (ctl->hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
if (keyinfo->keylen == 13)
cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
@@ -2422,7 +2423,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen);
IWL_DEBUG_TX("Configuring packet for WEP encryption "
- "with key %d\n", ctl->key_idx);
+ "with key %d\n", ctl->hw_key->hw_key_idx);
break;
default:
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index d7e2358..ae74042 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1936,7 +1936,7 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
struct iwl_wep_key *wepkey;
int keyidx = 0;
- BUG_ON(ctl->key_idx > 3);
+ BUG_ON(ctl->hw_key->hw_key_idx > 3);
switch (keyinfo->alg) {
case ALG_CCMP:
@@ -1955,11 +1955,11 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
break;
case ALG_WEP:
- wepkey = &priv->wep_keys[ctl->key_idx];
+ wepkey = &priv->wep_keys[ctl->hw_key->hw_key_idx];
cmd->cmd.tx.sec_ctl = 0;
if (priv->default_wep_key) {
/* the WEP key was sent as static */
- keyidx = ctl->key_idx;
+ keyidx = ctl->hw_key->hw_key_idx;
memcpy(&cmd->cmd.tx.key[3], wepkey->key,
wepkey->key_size);
if (wepkey->key_size == WEP_KEY_LEN_128)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4a80d74..27ef9f7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -286,8 +286,17 @@ enum mac80211_tx_control_flags {
/* Transmit control fields. This data structure is passed to low-level driver
* with each TX frame. The low-level driver is responsible for configuring
- * the hardware to use given values (depending on what is supported). */
-
+ * the hardware to use given values (depending on what is supported).
+ *
+ * NOTE: Be careful with using the pointers outside of the ieee80211_ops->tx()
+ * context (i.e. when defering the work to a workqueue).
+ * The vif pointer is valid until the it has been removed with the
+ * ieee80211_ops->remove_interface() callback funtion.
+ * The hw_key pointer is valid until it has been removed with the
+ * ieee80211_ops->set_key() callback function.
+ * The tx_rate and alt_retry_rate pointers are valid until the phy is
+ * deregistered.
+ */
struct ieee80211_tx_control {
struct ieee80211_vif *vif;
struct ieee80211_rate *tx_rate;
@@ -298,9 +307,11 @@ struct ieee80211_tx_control {
/* retry rate for the last retries */
struct ieee80211_rate *alt_retry_rate;
+ /* Key used for hardware encryption
+ * NULL if IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
+ struct ieee80211_key_conf *hw_key;
+
u32 flags; /* tx control flags defined above */
- u8 key_idx; /* keyidx from hw->set_key(), undefined if
- * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
u8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
* This could be used when set_retry_limit
* is not implemented by the driver */
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index affcecd..3cbae42 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -337,7 +337,7 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
return -1;
} else {
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
return -1;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 45709ad..42f3654 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -228,7 +228,7 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx,
0x7f),
(u8) key->u.tkip.iv16);
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return 0;
}
@@ -256,7 +256,7 @@ ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
!wpa_test) {
/* hwaccel - with no need for preallocated room for IV/ICV */
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return TX_CONTINUE;
}
@@ -478,7 +478,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx,
if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
/* hwaccel - with preallocated room for CCMP header */
- tx->control->key_idx = key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return 0;
}
@@ -505,7 +505,7 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
!(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
/* hwaccel - with no need for preallocated room for CCMP "
* header or MIC fields */
- tx->control->key_idx = tx->key->conf.hw_key_idx;
+ tx->control->hw_key = &tx->key->conf;
return TX_CONTINUE;
}
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH v4] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 17:41 ` [PATCH v4] " Ivo van Doorn
@ 2008-04-17 22:02 ` Johannes Berg
2008-04-18 16:56 ` Tomas Winkler
0 siblings, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2008-04-17 22:02 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: John W. Linville, linux-wireless, Zhu Yi, Reinette Chatre
[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]
> --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
> +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
> @@ -1936,7 +1936,7 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
> struct iwl_wep_key *wepkey;
> int keyidx = 0;
>
> - BUG_ON(ctl->key_idx > 3);
> + BUG_ON(ctl->hw_key->hw_key_idx > 3);
>
> switch (keyinfo->alg) {
> case ALG_CCMP:
> @@ -1955,11 +1955,11 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
> break;
>
> case ALG_WEP:
> - wepkey = &priv->wep_keys[ctl->key_idx];
> + wepkey = &priv->wep_keys[ctl->hw_key->hw_key_idx];
> cmd->cmd.tx.sec_ctl = 0;
> if (priv->default_wep_key) {
> /* the WEP key was sent as static */
> - keyidx = ctl->key_idx;
> + keyidx = ctl->hw_key->hw_key_idx;
> memcpy(&cmd->cmd.tx.key[3], wepkey->key,
> wepkey->key_size);
> if (wepkey->key_size == WEP_KEY_LEN_128)
All this is rather odd. I think you (Intel) may want to change it to use
hw_key->keyidx and just leave the hw_key_idx alone, it seems to be a
copy of keyidx in iwl4965 but an actual index as it was meant to be used
in iwl3945?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v4] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf
2008-04-17 22:02 ` Johannes Berg
@ 2008-04-18 16:56 ` Tomas Winkler
0 siblings, 0 replies; 10+ messages in thread
From: Tomas Winkler @ 2008-04-18 16:56 UTC (permalink / raw)
To: Johannes Berg
Cc: Ivo van Doorn, John W. Linville, linux-wireless, Zhu Yi,
Reinette Chatre, Grumbach, Emmanuel
On Fri, Apr 18, 2008 at 1:02 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
>
> > --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
> > @@ -1936,7 +1936,7 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
> > struct iwl_wep_key *wepkey;
> > int keyidx = 0;
> >
> > - BUG_ON(ctl->key_idx > 3);
> > + BUG_ON(ctl->hw_key->hw_key_idx > 3);
> >
> > switch (keyinfo->alg) {
> > case ALG_CCMP:
> > @@ -1955,11 +1955,11 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
> > break;
> >
> > case ALG_WEP:
> > - wepkey = &priv->wep_keys[ctl->key_idx];
> > + wepkey = &priv->wep_keys[ctl->hw_key->hw_key_idx];
> > cmd->cmd.tx.sec_ctl = 0;
> > if (priv->default_wep_key) {
> > /* the WEP key was sent as static */
> > - keyidx = ctl->key_idx;
> > + keyidx = ctl->hw_key->hw_key_idx;
> > memcpy(&cmd->cmd.tx.key[3], wepkey->key,
> > wepkey->key_size);
> > if (wepkey->key_size == WEP_KEY_LEN_128)
>
> All this is rather odd. I think you (Intel) may want to change it to use
> hw_key->keyidx and just leave the hw_key_idx alone, it seems to be a
> copy of keyidx in iwl4965 but an actual index as it was meant to be used
> in iwl3945?
Sure, this patch changes the picture., in addition the code can be a
bit simplified.
Will fix that.
Thanks
Tomas
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-04-18 16:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-17 15:28 [PATCH] mac80211: Replace ieee80211_tx_control->key_idx with ieee80211_key_conf Ivo van Doorn
2008-04-17 15:29 ` Michael Buesch
2008-04-17 15:56 ` Ivo van Doorn
2008-04-17 15:59 ` [PATCH v2] " Ivo van Doorn
2008-04-17 16:54 ` Johannes Berg
2008-04-17 17:23 ` [PATCH v3] " Ivo van Doorn
2008-04-17 17:26 ` Johannes Berg
2008-04-17 17:41 ` [PATCH v4] " Ivo van Doorn
2008-04-17 22:02 ` Johannes Berg
2008-04-18 16:56 ` Tomas Winkler
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).