iwlwifi: mvm: remove IWL_UCODE_TLV_API_STATS_V10 TLV flag
[cascardo/linux.git] / drivers / net / wireless / iwlwifi / mvm / rx.c
index 73054dd..c203a1b 100644 (file)
@@ -61,6 +61,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *****************************************************************************/
+#include <linux/skbuff.h>
 #include "iwl-trans.h"
 #include "mvm.h"
 #include "fw-api.h"
@@ -93,6 +94,7 @@ void iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
  * Adds the rxb to a new skb and give it to mac80211
  */
 static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm,
+                                           struct napi_struct *napi,
                                            struct sk_buff *skb,
                                            struct ieee80211_hdr *hdr, u16 len,
                                            u32 ampdu_status, u8 crypt_len,
@@ -126,7 +128,7 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm,
                                fraglen, rxb->truesize);
        }
 
-       ieee80211_rx(mvm->hw, skb);
+       ieee80211_rx_napi(mvm->hw, skb, napi);
 }
 
 /*
@@ -234,12 +236,26 @@ static u32 iwl_mvm_set_mac80211_rx_flag(struct iwl_mvm *mvm,
        return 0;
 }
 
+static void iwl_mvm_rx_csum(struct ieee80211_sta *sta,
+                           struct sk_buff *skb,
+                           u32 status)
+{
+       struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
+       struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
+
+       if (mvmvif->features & NETIF_F_RXCSUM &&
+           status & RX_MPDU_RES_STATUS_CSUM_DONE &&
+           status & RX_MPDU_RES_STATUS_CSUM_OK)
+               skb->ip_summed = CHECKSUM_UNNECESSARY;
+}
+
 /*
  * iwl_mvm_rx_rx_mpdu - REPLY_RX_MPDU_CMD handler
  *
  * Handles the actual data of the Rx packet from the fw
  */
-void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
+void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
+                       struct iwl_rx_cmd_buffer *rxb)
 {
        struct ieee80211_hdr *hdr;
        struct ieee80211_rx_status *rx_status;
@@ -362,6 +378,9 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
                }
        }
 
+       if (sta && ieee80211_is_data(hdr->frame_control))
+               iwl_mvm_rx_csum(sta, skb, rx_pkt_status);
+
        rcu_read_unlock();
 
        /* set the preamble flag if appropriate */
@@ -425,7 +444,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
        iwl_mvm_update_frame_stats(mvm, rate_n_flags,
                                   rx_status->flag & RX_FLAG_AMPDU_DETAILS);
 #endif
-       iwl_mvm_pass_packet_to_mac80211(mvm, skb, hdr, len, ampdu_status,
+       iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, hdr, len, ampdu_status,
                                        crypt_len, rxb);
 }
 
@@ -440,7 +459,7 @@ static void iwl_mvm_update_rx_statistics(struct iwl_mvm *mvm,
 struct iwl_mvm_stat_data {
        struct iwl_mvm *mvm;
        __le32 mac_id;
-       __s8 beacon_filter_average_energy;
+       u8 beacon_filter_average_energy;
        struct mvm_statistics_general_v8 *general;
 };
 
@@ -558,56 +577,33 @@ iwl_mvm_rx_stats_check_trigger(struct iwl_mvm *mvm, struct iwl_rx_packet *pkt)
 void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
                                  struct iwl_rx_packet *pkt)
 {
-       size_t v8_len = sizeof(struct iwl_notif_statistics_v8);
-       size_t v10_len = sizeof(struct iwl_notif_statistics_v10);
+       struct iwl_notif_statistics_v10 *stats = (void *)&pkt->data;
        struct iwl_mvm_stat_data data = {
                .mvm = mvm,
        };
        u32 temperature;
 
-       if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STATS_V10)) {
-               struct iwl_notif_statistics_v10 *stats = (void *)&pkt->data;
-
-               if (iwl_rx_packet_payload_len(pkt) != v10_len)
-                       goto invalid;
+       if (iwl_rx_packet_payload_len(pkt) != sizeof(*stats))
+               goto invalid;
 
-               temperature = le32_to_cpu(stats->general.radio_temperature);
-               data.mac_id = stats->rx.general.mac_id;
-               data.beacon_filter_average_energy =
-                       stats->general.beacon_filter_average_energy;
+       temperature = le32_to_cpu(stats->general.radio_temperature);
+       data.mac_id = stats->rx.general.mac_id;
+       data.beacon_filter_average_energy =
+               stats->general.beacon_filter_average_energy;
 
-               iwl_mvm_update_rx_statistics(mvm, &stats->rx);
+       iwl_mvm_update_rx_statistics(mvm, &stats->rx);
 
-               mvm->radio_stats.rx_time = le64_to_cpu(stats->general.rx_time);
-               mvm->radio_stats.tx_time = le64_to_cpu(stats->general.tx_time);
-               mvm->radio_stats.on_time_rf =
-                       le64_to_cpu(stats->general.on_time_rf);
-               mvm->radio_stats.on_time_scan =
-                       le64_to_cpu(stats->general.on_time_scan);
+       mvm->radio_stats.rx_time = le64_to_cpu(stats->general.rx_time);
+       mvm->radio_stats.tx_time = le64_to_cpu(stats->general.tx_time);
+       mvm->radio_stats.on_time_rf =
+               le64_to_cpu(stats->general.on_time_rf);
+       mvm->radio_stats.on_time_scan =
+               le64_to_cpu(stats->general.on_time_scan);
 
-               data.general = &stats->general;
-       } else {
-               struct iwl_notif_statistics_v8 *stats = (void *)&pkt->data;
-
-               if (iwl_rx_packet_payload_len(pkt) != v8_len)
-                       goto invalid;
-
-               temperature = le32_to_cpu(stats->general.radio_temperature);
-               data.mac_id = stats->rx.general.mac_id;
-               data.beacon_filter_average_energy =
-                       stats->general.beacon_filter_average_energy;
-
-               iwl_mvm_update_rx_statistics(mvm, &stats->rx);
-       }
+       data.general = &stats->general;
 
        iwl_mvm_rx_stats_check_trigger(mvm, pkt);
 
-       /* Only handle rx statistics temperature changes if async temp
-        * notifications are not supported
-        */
-       if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_ASYNC_DTM))
-               iwl_mvm_tt_temp_changed(mvm, temperature);
-
        ieee80211_iterate_active_interfaces(mvm->hw,
                                            IEEE80211_IFACE_ITER_NORMAL,
                                            iwl_mvm_stat_iterator,