linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Christian Lamparter <chunkeey@web.de>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFT][RFC][PATCH] p54: utilize cryptographic accelerator
Date: Wed, 26 Nov 2008 18:15:57 -0600	[thread overview]
Message-ID: <492DE6BD.5060206@lwfinger.net> (raw)
In-Reply-To: <200811242215.00475.chunkeey@web.de>

Christian Lamparter wrote:
> This patch allows p54 to utilize its WEP, TKIP and CCMP accelerator.
> 
> Signed-off-by: Christian Lamparter <chunkeey@web.de>
> ---
> diff -Nurp a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
> --- a/drivers/net/wireless/p54/p54common.c	2008-11-24 21:05:42.590287518 +0100
> +++ b/drivers/net/wireless/p54/p54common.c	2008-11-24 22:06:13.951266225 +0100
> @@ -25,6 +25,9 @@
>  #include "p54.h"
>  #include "p54common.h"
>  
> +static int modparam_nohwcrypt;
> +module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
> +MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
>  MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
--snip--
> +
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(p54_parse_firmware);
> @@ -527,6 +542,11 @@ static int p54_rx_data(struct ieee80211_
>  			return 0;
>  	}
>  
> +	if (hdr->decrypt_status == P54_DECRYPT_OK)
> +		rx_status.flag |= RX_FLAG_DECRYPTED;
> +	if (hdr->decrypt_status == P54_DECRYPT_FAIL_MICHAEL)
> +		rx_status.flag |= RX_FLAG_MMIC_ERROR;
> +
>  	rx_status.signal = p54_rssi_to_dbm(dev, hdr->rssi);
>  	rx_status.noise = priv->noise;
>  	/* XX correct? */
> @@ -843,6 +863,8 @@ static int p54_assign_address(struct iee
>  
>  	spin_lock_irqsave(&priv->tx_queue.lock, flags);
>  	left = skb_queue_len(&priv->tx_queue);
> +	if (left > 30)
> +		return -ENOMEM;

The above returns with tx_queue.lock still set.

>  	while (left--) {
>  		u32 hole_size;
>  		info = IEEE80211_SKB_CB(entry);
> @@ -1082,6 +1104,20 @@ static int p54_tx_fill(struct ieee80211_
>  	return ret;
>  }
>  
--snip--
> +		}
> +	}
> +
> +	mutex_lock(&priv->conf_mutex);
> +	skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*rxkey) +
> +			sizeof(struct p54_hdr),	P54_CONTROL_TYPE_RX_KEYCACHE,
> +			GFP_ATOMIC);
> +	if (!skb) {
> +		mutex_unlock(&priv->conf_mutex);
> +		return -ENOMEM;
> +	}
> +
> +	rxkey = (struct p54_keycache *)skb_put(skb, sizeof(*rxkey));
> +	rxkey->entry = cpu_to_le16(key->keyidx);
> +	rxkey->key_id = cpu_to_le16(key->keyidx);

Sparse objects to the above two statments because key->keyidx is of type s8, and
both rxkey->entry and rxkey->key_id are of type u8. A conversion to le16 is not
needed.

A patch for both problems is below:

Larry

=========

Index: wireless-testing/drivers/net/wireless/p54/p54common.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/p54/p54common.c
+++ wireless-testing/drivers/net/wireless/p54/p54common.c
@@ -862,8 +862,10 @@ static int p54_assign_address(struct iee

 	spin_lock_irqsave(&priv->tx_queue.lock, flags);
 	left = skb_queue_len(&priv->tx_queue);
-	if (left > 30)
+	if (left > 30) {
+		spin_unlock_irqrestore(&priv->tx_queue.lock, flags);
 		return -ENOMEM;
+	}
 	while (left--) {
 		u32 hole_size;
 		info = IEEE80211_SKB_CB(entry);
@@ -1944,8 +1946,8 @@ static int p54_set_key(struct ieee80211_
 	}

 	rxkey = (struct p54_keycache *)skb_put(skb, sizeof(*rxkey));
-	rxkey->entry = cpu_to_le16(key->keyidx);
-	rxkey->key_id = cpu_to_le16(key->keyidx);
+	rxkey->entry = key->keyidx;
+	rxkey->key_id = key->keyidx;
 	rxkey->key_len = min((u8)24, key->keylen);
 	rxkey->key_type = algo;
 	if (address)

  parent reply	other threads:[~2008-11-27  0:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-24 21:15 [RFT][RFC][PATCH] p54: utilize cryptographic accelerator Christian Lamparter
2008-11-25  3:52 ` Larry Finger
2008-11-27  0:15 ` Larry Finger [this message]
2008-11-27 11:26   ` Christian Lamparter
2008-11-27 14:37     ` Larry Finger

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=492DE6BD.5060206@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=chunkeey@web.de \
    --cc=linux-wireless@vger.kernel.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).