Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

mac80211: add op to configure default key id to driver (INTERNAL)

When hw_accel is enabled and encryption type is set to WEP,
the driver should get the default key index from mac80211.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information...
commit 6eedfe6a35f773cddae785184a1e614deb9f7106 1 parent 6ad429f
@yonid yonid authored ariknem committed
View
5 include/net/mac80211.h
@@ -1442,6 +1442,9 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
* rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
* provided by update_tkip_key only. The trigger that makes mac80211 call this
* handler is software decryption with wrap around of iv16.
+ *
+ * The set_default_key_idx() call updates the default WEP key index configured
+ * to the hardware for WEP encryption type.
*/
/**
@@ -2398,6 +2401,8 @@ struct ieee80211_ops {
void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
+ int (*set_default_key_idx)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif, int idx);
};
/**
View
3  net/mac80211/cfg.c
@@ -309,9 +309,8 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- ieee80211_set_default_key(sdata, key_idx, uni, multi);
+ return ieee80211_set_default_key(sdata, key_idx, uni, multi);
- return 0;
}
static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy,
View
17 net/mac80211/driver-ops.h
@@ -866,4 +866,21 @@ static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
trace_drv_return_void(local);
}
+
+static inline int
+drv_set_default_unicast_key(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ int key_idx)
+{
+ int ret = 0;
+ check_sdata_in_driver(sdata);
+
+ if (local->ops->set_default_key_idx)
+ ret = local->ops->set_default_key_idx(&local->hw, &sdata->vif,
+ key_idx);
+
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
#endif /* __MAC80211_DRIVER_OPS */
View
6 net/mac80211/key.c
@@ -232,12 +232,16 @@ static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata,
ieee80211_debugfs_key_update_default(sdata);
}
-void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
+int ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
bool uni, bool multi)
{
+ int ret = 0;
mutex_lock(&sdata->local->key_mtx);
__ieee80211_set_default_key(sdata, idx, uni, multi);
+ if (uni)
+ ret = drv_set_default_unicast_key(sdata->local, sdata, idx);
mutex_unlock(&sdata->local->key_mtx);
+ return ret;
}
static void
View
2  net/mac80211/key.h
@@ -136,7 +136,7 @@ int __must_check ieee80211_key_link(struct ieee80211_key *key,
void __ieee80211_key_free(struct ieee80211_key *key);
void ieee80211_key_free(struct ieee80211_local *local,
struct ieee80211_key *key);
-void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
+int ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
bool uni, bool multi);
void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata,
int idx);
Please sign in to comment.
Something went wrong with that request. Please try again.