Merge branch 'for-4.2/sg' of git://git.kernel.dk/linux-block
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rtlwifi / base.c
index 074f716020aae4e28d3e8340da846514065a94db..0517a4f2d3f2f0b602a6c51763a1666e03abce2b 100644 (file)
@@ -394,20 +394,18 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
                }
        }
        /* <5> set hw caps */
-       hw->flags = IEEE80211_HW_SIGNAL_DBM |
-           IEEE80211_HW_RX_INCLUDES_FCS |
-           IEEE80211_HW_AMPDU_AGGREGATION |
-           IEEE80211_HW_CONNECTION_MONITOR |
-           /* IEEE80211_HW_SUPPORTS_CQM_RSSI | */
-           IEEE80211_HW_MFP_CAPABLE |
-           IEEE80211_HW_REPORTS_TX_ACK_STATUS | 0;
+       ieee80211_hw_set(hw, SIGNAL_DBM);
+       ieee80211_hw_set(hw, RX_INCLUDES_FCS);
+       ieee80211_hw_set(hw, AMPDU_AGGREGATION);
+       ieee80211_hw_set(hw, CONNECTION_MONITOR);
+       ieee80211_hw_set(hw, MFP_CAPABLE);
+       ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
 
        /* swlps or hwlps has been set in diff chip in init_sw_vars */
-       if (rtlpriv->psc.swctrl_lps)
-               hw->flags |= IEEE80211_HW_SUPPORTS_PS |
-                       IEEE80211_HW_PS_NULLFUNC_STACK |
-                       /* IEEE80211_HW_SUPPORTS_DYNAMIC_PS | */
-                       0;
+       if (rtlpriv->psc.swctrl_lps) {
+               ieee80211_hw_set(hw, SUPPORTS_PS);
+               ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
+       }
        hw->wiphy->interface_modes =
            BIT(NL80211_IFTYPE_AP) |
            BIT(NL80211_IFTYPE_STATION) |
@@ -1315,7 +1313,8 @@ static void setup_arp_tx(struct rtl_priv *rtlpriv, struct rtl_ps_ctl *ppsc)
 }
 
 /*should call before software enc*/
-u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
+u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
+                      bool is_enc)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
@@ -1344,7 +1343,9 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
                break;
        }
 
-       offset = mac_hdr_len + SNAP_SIZE + encrypt_header_len;
+       offset = mac_hdr_len + SNAP_SIZE;
+       if (is_enc)
+               offset += encrypt_header_len;
        ether_type = be16_to_cpup((__be16 *)(skb->data + offset));
 
        if (ETH_P_IP == ether_type) {