aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYoni Divinsky <yoni.divinsky@ti.com>2012-05-30 04:36:39 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-01-18 07:30:21 -0500
commitde5fad815703b5b24bc4726cd71422929537d259 (patch)
tree4b2c5ab023fc4577748c2a340f10ab6cd0ea515e /net
parent5a32aff37a02ebc959837f08d09ac8ba65d4f1b0 (diff)
mac80211: add op to configure default key id
There are hardwares which support offload of data packets for example when auto ARP is enabled the hw will send the ARP response. In such cases if WEP encryption is configured the hw must know the default WEP key in order to encrypt the packets correctly. 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> [cleanups, fixes, documentation] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/driver-ops.h16
-rw-r--r--net/mac80211/key.c5
-rw-r--r--net/mac80211/trace.h23
3 files changed, 43 insertions, 1 deletions
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 0c07f94c5378..e6033b06caba 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1020,4 +1020,20 @@ static inline void drv_restart_complete(struct ieee80211_local *local)
1020 trace_drv_return_void(local); 1020 trace_drv_return_void(local);
1021} 1021}
1022 1022
1023static inline void
1024drv_set_default_unicast_key(struct ieee80211_local *local,
1025 struct ieee80211_sub_if_data *sdata,
1026 int key_idx)
1027{
1028 check_sdata_in_driver(sdata);
1029
1030 WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
1031
1032 trace_drv_set_default_unicast_key(local, sdata, key_idx);
1033 if (local->ops->set_default_unicast_key)
1034 local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
1035 key_idx);
1036 trace_drv_return_void(local);
1037}
1038
1023#endif /* __MAC80211_DRIVER_OPS */ 1039#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 619c5d697999..ef252eb58c36 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -204,8 +204,11 @@ static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata,
204 if (idx >= 0 && idx < NUM_DEFAULT_KEYS) 204 if (idx >= 0 && idx < NUM_DEFAULT_KEYS)
205 key = key_mtx_dereference(sdata->local, sdata->keys[idx]); 205 key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
206 206
207 if (uni) 207 if (uni) {
208 rcu_assign_pointer(sdata->default_unicast_key, key); 208 rcu_assign_pointer(sdata->default_unicast_key, key);
209 drv_set_default_unicast_key(sdata->local, sdata, idx);
210 }
211
209 if (multi) 212 if (multi)
210 rcu_assign_pointer(sdata->default_multicast_key, key); 213 rcu_assign_pointer(sdata->default_multicast_key, key);
211 214
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 41861b91daa3..9341b9359b66 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1821,6 +1821,29 @@ TRACE_EVENT(stop_queue,
1821 ) 1821 )
1822); 1822);
1823 1823
1824TRACE_EVENT(drv_set_default_unicast_key,
1825 TP_PROTO(struct ieee80211_local *local,
1826 struct ieee80211_sub_if_data *sdata,
1827 int key_idx),
1828
1829 TP_ARGS(local, sdata, key_idx),
1830
1831 TP_STRUCT__entry(
1832 LOCAL_ENTRY
1833 VIF_ENTRY
1834 __field(int, key_idx)
1835 ),
1836
1837 TP_fast_assign(
1838 LOCAL_ASSIGN;
1839 VIF_ASSIGN;
1840 __entry->key_idx = key_idx;
1841 ),
1842
1843 TP_printk(LOCAL_PR_FMT VIF_PR_FMT " key_idx:%d",
1844 LOCAL_PR_ARG, VIF_PR_ARG, __entry->key_idx)
1845);
1846
1824#ifdef CONFIG_MAC80211_MESSAGE_TRACING 1847#ifdef CONFIG_MAC80211_MESSAGE_TRACING
1825#undef TRACE_SYSTEM 1848#undef TRACE_SYSTEM
1826#define TRACE_SYSTEM mac80211_msg 1849#define TRACE_SYSTEM mac80211_msg