Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1f5a7e47ae58cc23c623c09f1c9d97b7a8cf6344
Commit:     1f5a7e47ae58cc23c623c09f1c9d97b7a8cf6344
Parent:     75c35aa4e2931b22e8e95fa2d6380eebac229f30
Author:     Johannes Berg <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 27 15:43:23 2007 +0200
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:47:34 2007 -0700

    [MAC80211]: split out some key functions from ieee80211.c
    
    into a new file key.c which doesn't have much code right now but
    it makes ieee80211.c easier to read.
    
    Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
    Signed-off-by: Jiri Benc <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 net/mac80211/Makefile      |    1 +
 net/mac80211/ieee80211.c   |   56 -----------------------------------
 net/mac80211/ieee80211_i.h |   14 +++++----
 net/mac80211/key.c         |   69 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 78 insertions(+), 62 deletions(-)

diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 8482602..d95de3f 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -20,4 +20,5 @@ mac80211-objs := \
        ieee80211_cfg.o \
        rx.o \
        tx.o \
+       key.o \
        $(mac80211-objs-y)
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 02fb00e..f20e647 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -33,7 +33,6 @@
 #include "ieee80211_cfg.h"
 #include "debugfs.h"
 #include "debugfs_netdev.h"
-#include "debugfs_key.h"
 
 /* privid for wiphys to determine whether they belong to us or not */
 void *mac80211_wiphy_privid = &mac80211_wiphy_privid;
@@ -63,61 +62,6 @@ struct ieee80211_tx_status_rtap_hdr {
 } __attribute__ ((packed));
 
 
-struct ieee80211_key_conf *
-ieee80211_key_data2conf(struct ieee80211_local *local,
-                       const struct ieee80211_key *data)
-{
-       struct ieee80211_key_conf *conf;
-
-       conf = kmalloc(sizeof(*conf) + data->keylen, GFP_ATOMIC);
-       if (!conf)
-               return NULL;
-
-       conf->hw_key_idx = data->hw_key_idx;
-       conf->alg = data->alg;
-       conf->keylen = data->keylen;
-       conf->flags = 0;
-       if (data->force_sw_encrypt)
-               conf->flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
-       conf->keyidx = data->keyidx;
-       if (data->default_tx_key)
-               conf->flags |= IEEE80211_KEY_DEFAULT_TX_KEY;
-       if (local->default_wep_only)
-               conf->flags |= IEEE80211_KEY_DEFAULT_WEP_ONLY;
-       memcpy(conf->key, data->key, data->keylen);
-
-       return conf;
-}
-
-struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
-                                         int idx, size_t key_len, gfp_t flags)
-{
-       struct ieee80211_key *key;
-
-       key = kzalloc(sizeof(struct ieee80211_key) + key_len, flags);
-       if (!key)
-               return NULL;
-       kref_init(&key->kref);
-       return key;
-}
-
-static void ieee80211_key_release(struct kref *kref)
-{
-       struct ieee80211_key *key;
-
-       key = container_of(kref, struct ieee80211_key, kref);
-       if (key->alg == ALG_CCMP)
-               ieee80211_aes_key_free(key->u.ccmp.tfm);
-       ieee80211_debugfs_key_remove(key);
-       kfree(key);
-}
-
-void ieee80211_key_free(struct ieee80211_key *key)
-{
-       if (key)
-               kref_put(&key->kref, ieee80211_key_release);
-}
-
 static int rate_list_match(const int *rate_list, int rate)
 {
        int i;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 9d3401d..af8b984 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -719,12 +719,6 @@ static inline int ieee80211_bssid_match(const u8 *raddr, 
const u8 *addr)
 int ieee80211_hw_config(struct ieee80211_local *local);
 int ieee80211_if_config(struct net_device *dev);
 int ieee80211_if_config_beacon(struct net_device *dev);
-struct ieee80211_key_conf *
-ieee80211_key_data2conf(struct ieee80211_local *local,
-                       const struct ieee80211_key *data);
-struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
-                                         int idx, size_t key_len, gfp_t flags);
-void ieee80211_key_free(struct ieee80211_key *key);
 void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
                       struct ieee80211_rx_status *status, u32 msg_type);
 void ieee80211_prepare_rates(struct ieee80211_local *local,
@@ -833,6 +827,14 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb, 
struct net_device *dev);
 int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
 int ieee80211_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev);
 
+/* key handling */
+struct ieee80211_key_conf *
+ieee80211_key_data2conf(struct ieee80211_local *local,
+                       const struct ieee80211_key *data);
+struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
+                                         int idx, size_t key_len, gfp_t flags);
+void ieee80211_key_free(struct ieee80211_key *key);
+
 /* for wiphy privid */
 extern void *mac80211_wiphy_privid;
 
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
new file mode 100644
index 0000000..b67558c
--- /dev/null
+++ b/net/mac80211/key.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2002-2005, Instant802 Networks, Inc.
+ * Copyright 2005-2006, Devicescape Software, Inc.
+ * Copyright 2006-2007 Jiri Benc <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <net/mac80211.h>
+#include "ieee80211_i.h"
+#include "debugfs_key.h"
+#include "aes_ccm.h"
+
+struct ieee80211_key_conf *
+ieee80211_key_data2conf(struct ieee80211_local *local,
+                       const struct ieee80211_key *data)
+{
+       struct ieee80211_key_conf *conf;
+
+       conf = kmalloc(sizeof(*conf) + data->keylen, GFP_ATOMIC);
+       if (!conf)
+               return NULL;
+
+       conf->hw_key_idx = data->hw_key_idx;
+       conf->alg = data->alg;
+       conf->keylen = data->keylen;
+       conf->flags = 0;
+       if (data->force_sw_encrypt)
+               conf->flags |= IEEE80211_KEY_FORCE_SW_ENCRYPT;
+       conf->keyidx = data->keyidx;
+       if (data->default_tx_key)
+               conf->flags |= IEEE80211_KEY_DEFAULT_TX_KEY;
+       if (local->default_wep_only)
+               conf->flags |= IEEE80211_KEY_DEFAULT_WEP_ONLY;
+       memcpy(conf->key, data->key, data->keylen);
+
+       return conf;
+}
+
+struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
+                                         int idx, size_t key_len, gfp_t flags)
+{
+       struct ieee80211_key *key;
+
+       key = kzalloc(sizeof(struct ieee80211_key) + key_len, flags);
+       if (!key)
+               return NULL;
+       kref_init(&key->kref);
+       return key;
+}
+
+static void ieee80211_key_release(struct kref *kref)
+{
+       struct ieee80211_key *key;
+
+       key = container_of(kref, struct ieee80211_key, kref);
+       if (key->alg == ALG_CCMP)
+               ieee80211_aes_key_free(key->u.ccmp.tfm);
+       ieee80211_debugfs_key_remove(key);
+       kfree(key);
+}
+
+void ieee80211_key_free(struct ieee80211_key *key)
+{
+       if (key)
+               kref_put(&key->kref, ieee80211_key_release);
+}
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to