All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kalle.valo@iki.fi>
To: linux-wireless@vger.kernel.org
Cc: Pavel Roskin <proski@gnu.org>
Subject: [PATCH 07/12] Add support for WEP
Date: Sun, 10 Feb 2008 17:00:41 +0200	[thread overview]
Message-ID: <20080210150041.17592.23590.stgit@tikku> (raw)
In-Reply-To: <20080210145733.17592.61729.stgit@tikku>

Signed-off-by: Kalle Valo <kalle.valo@iki.fi>
---

 drivers/net/wireless/at76_usb.c |   53 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 52 insertions(+), 1 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 0d26086..4ffae92 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -20,7 +20,6 @@
  *
  * TODO for the mac80211 port:
  * o adhoc support
- * o hardware wep encryption
  * o RTS/CTS support
  * o Power Save Mode support
  * o support for short/long preambles
@@ -5056,6 +5055,8 @@ static void at76_rx_tasklet(unsigned long param)
 			      priv->rx_skb->len);
 
 		rx_status.ssi = buf->rssi;
+		rx_status.flag |= RX_FLAG_DECRYPTED;
+		rx_status.flag |= RX_FLAG_IV_STRIPPED;
 
 		at76_dbg(DBG_MAC80211, "calling ieee80211_rx_irqsafe(): %d/%d",
 			 priv->rx_skb->len, priv->rx_skb->data_len);
@@ -5555,6 +5556,55 @@ static void at76_configure_filter(struct ieee80211_hw *hw,
 	queue_work(hw->workqueue, &priv->work_set_promisc);
 }
 
+static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+			const u8 *local_address, const u8 *address,
+			struct ieee80211_key_conf *key)
+{
+	struct at76_mac80211_priv *m_priv = hw->priv;
+	struct at76_priv *priv = m_priv->at76_priv;
+	int i;
+
+	at76_dbg(DBG_MAC80211, "%s(): cmd %d key->alg %d key->keyidx %d "
+		 "key->keylen %d",
+		 __func__, cmd, key->alg, key->keyidx, key->keylen);
+
+	if (key->alg != ALG_WEP)
+		return -EOPNOTSUPP;
+
+	key->hw_key_idx = key->keyidx;
+
+	mutex_lock(&priv->mtx);
+
+	switch (cmd) {
+	case SET_KEY:
+		memcpy(priv->wep_keys[key->keyidx], key->key, key->keylen);
+		priv->wep_keys_len[key->keyidx] = key->keylen;
+
+		/* FIXME: find out how to do this properly */
+		priv->wep_key_id = key->keyidx;
+
+		break;
+	case DISABLE_KEY:
+	default:
+		priv->wep_keys_len[key->keyidx] = 0;
+		break;
+	}
+
+	priv->wep_enabled = 0;
+
+	for (i = 0; i < WEP_KEYS; i++) {
+		if (priv->wep_keys_len[i] != 0)
+			priv->wep_enabled = 1;
+	}
+
+	at76_startup_device(priv);
+
+	mutex_unlock(&priv->mtx);
+
+	return 0;
+}
+
+
 static const struct ieee80211_ops at76_ops = {
 	.tx = at76_mac80211_tx,
 	.add_interface = at76_add_interface,
@@ -5565,6 +5615,7 @@ static const struct ieee80211_ops at76_ops = {
 	.start = at76_mac80211_start,
 	.stop = at76_mac80211_stop,
 	.hw_scan = at76_hw_scan,
+	.set_key = at76_set_key,
 };
 
 /* Allocate network device and initialize private data */


  parent reply	other threads:[~2008-02-10 15:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-10 14:59 [PATCH 00/12] at76_usb mac80211 port Kalle Valo
2008-02-10 14:59 ` [PATCH 01/12] Use net/mac80211.h instead of net/ieee80211.h Kalle Valo
2008-02-10 15:00 ` [PATCH 02/12] Add at76_dbg_dump() macro Kalle Valo
2008-02-10 15:00 ` [PATCH 03/12] Convert DBG_TX levels to use at76_dbg_dump() Kalle Valo
2008-02-10 15:00 ` [PATCH 04/12] Add DBG_CMD for debugging firmware commands Kalle Valo
2008-02-10 15:00 ` [PATCH 05/12] at76_usb: add mac80211 support Kalle Valo
2008-02-10 15:00 ` [PATCH 06/12] Add support for monitor mode Kalle Valo
2008-02-10 15:49   ` Michael Buesch
2008-02-10 15:52     ` Michael Buesch
2008-03-09 16:10     ` Kalle Valo
2008-03-09 17:39       ` Michael Buesch
2008-02-10 15:00 ` Kalle Valo [this message]
2008-02-10 15:00 ` [PATCH 08/12] Remove support the legacy stack Kalle Valo
2008-02-10 15:00 ` [PATCH 09/12] Use wiphy_name everywhere where needed Kalle Valo
2008-02-10 15:01 ` [PATCH 10/12] Allocate struct at76_priv using ieee80211_alloc_hw() Kalle Valo
2008-02-10 15:01 ` [PATCH 11/12] Prepare for struct net_device removal Kalle Valo
2008-02-10 15:01 ` [PATCH 12/12] Remove struct net_device Kalle Valo
2008-02-11  5:05 ` [PATCH 00/12] at76_usb mac80211 port Pavel Roskin
2008-02-11  5:17   ` Pavel Roskin
2008-03-09 16:43   ` Kalle Valo
2008-03-10  1:00     ` 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=20080210150041.17592.23590.stgit@tikku \
    --to=kalle.valo@iki.fi \
    --cc=linux-wireless@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.