mac80211: add rx decapsulation offload support
[linux-2.6-microblaze.git] / net / mac80211 / iface.c
index 3b9ec4e..1b44690 100644 (file)
@@ -765,7 +765,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
        .ndo_get_stats64        = ieee80211_get_stats64,
 };
 
-static bool ieee80211_iftype_supports_encap_offload(enum nl80211_iftype iftype)
+static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
 {
        switch (iftype) {
        /* P2P GO and client are mapped to AP/STATION types */
@@ -785,7 +785,7 @@ static bool ieee80211_set_sdata_offload_flags(struct ieee80211_sub_if_data *sdat
        flags = sdata->vif.offload_flags;
 
        if (ieee80211_hw_check(&local->hw, SUPPORTS_TX_ENCAP_OFFLOAD) &&
-           ieee80211_iftype_supports_encap_offload(sdata->vif.type)) {
+           ieee80211_iftype_supports_hdr_offload(sdata->vif.type)) {
                flags |= IEEE80211_OFFLOAD_ENCAP_ENABLED;
 
                if (!ieee80211_hw_check(&local->hw, SUPPORTS_TX_FRAG) &&
@@ -798,10 +798,21 @@ static bool ieee80211_set_sdata_offload_flags(struct ieee80211_sub_if_data *sdat
                flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED;
        }
 
+       if (ieee80211_hw_check(&local->hw, SUPPORTS_RX_DECAP_OFFLOAD) &&
+           ieee80211_iftype_supports_hdr_offload(sdata->vif.type)) {
+               flags |= IEEE80211_OFFLOAD_DECAP_ENABLED;
+
+               if (local->monitors)
+                       flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED;
+       } else {
+               flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED;
+       }
+
        if (sdata->vif.offload_flags == flags)
                return false;
 
        sdata->vif.offload_flags = flags;
+       ieee80211_check_fast_rx_iface(sdata);
        return true;
 }
 
@@ -819,7 +830,7 @@ static void ieee80211_set_vif_encap_ops(struct ieee80211_sub_if_data *sdata)
        }
 
        if (!ieee80211_hw_check(&local->hw, SUPPORTS_TX_ENCAP_OFFLOAD) ||
-           !ieee80211_iftype_supports_encap_offload(bss->vif.type))
+           !ieee80211_iftype_supports_hdr_offload(bss->vif.type))
                return;
 
        enabled = bss->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED;