* 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_unicast_key() call updates the default WEP key index
+ * configured to the hardware for WEP encryption type. This is required
+ * for devices that support offload of data packets (e.g. ARP responses).
  */
 
 /**
  *     After rekeying was done it should (for example during resume) notify
  *     userspace of the new replay counter using ieee80211_gtk_rekey_notify().
  *
+ * @set_default_unicast_key: Set the default (unicast) key index, useful for
+ *     WEP when the device sends data packets autonomously, e.g. for ARP
+ *     offloading. The index can be 0-3, or -1 for unsetting it.
+ *
  * @hw_scan: Ask the hardware to service the scan request, no need to start
  *     the scan state machine in stack. The scan must honour the channel
  *     configuration done by the regulatory agent in the wiphy's
        void (*set_rekey_data)(struct ieee80211_hw *hw,
                               struct ieee80211_vif *vif,
                               struct cfg80211_gtk_rekey_data *data);
+       void (*set_default_unicast_key)(struct ieee80211_hw *hw,
+                                       struct ieee80211_vif *vif, int idx);
        int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                       struct cfg80211_scan_request *req);
        void (*cancel_hw_scan)(struct ieee80211_hw *hw,
 
        trace_drv_return_void(local);
 }
 
+static inline void
+drv_set_default_unicast_key(struct ieee80211_local *local,
+                           struct ieee80211_sub_if_data *sdata,
+                           int key_idx)
+{
+       check_sdata_in_driver(sdata);
+
+       WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
+
+       trace_drv_set_default_unicast_key(local, sdata, key_idx);
+       if (local->ops->set_default_unicast_key)
+               local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
+                                                   key_idx);
+       trace_drv_return_void(local);
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
 
        if (idx >= 0 && idx < NUM_DEFAULT_KEYS)
                key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
 
-       if (uni)
+       if (uni) {
                rcu_assign_pointer(sdata->default_unicast_key, key);
+               drv_set_default_unicast_key(sdata->local, sdata, idx);
+       }
+
        if (multi)
                rcu_assign_pointer(sdata->default_multicast_key, key);
 
 
        )
 );
 
+TRACE_EVENT(drv_set_default_unicast_key,
+       TP_PROTO(struct ieee80211_local *local,
+                struct ieee80211_sub_if_data *sdata,
+                int key_idx),
+
+       TP_ARGS(local, sdata, key_idx),
+
+       TP_STRUCT__entry(
+               LOCAL_ENTRY
+               VIF_ENTRY
+               __field(int, key_idx)
+       ),
+
+       TP_fast_assign(
+               LOCAL_ASSIGN;
+               VIF_ASSIGN;
+               __entry->key_idx = key_idx;
+       ),
+
+       TP_printk(LOCAL_PR_FMT VIF_PR_FMT " key_idx:%d",
+                 LOCAL_PR_ARG, VIF_PR_ARG, __entry->key_idx)
+);
+
 #ifdef CONFIG_MAC80211_MESSAGE_TRACING
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM mac80211_msg