Blame SOURCES/0018-Revert-iwlwifi-mvm-bring-back-mvm-GSO-code.patch

deb259
From 3aa78b629f25d741b8cfe9af2b982b34078e098a Mon Sep 17 00:00:00 2001
deb259
From: Eugene Syromiatnikov <esyr@redhat.com>
deb259
Date: Thu, 25 Jul 2019 15:37:32 +0200
deb259
Subject: [PATCH 2/7] Revert "iwlwifi: mvm: bring back mvm GSO code"
deb259
deb259
This reverts commit 08f7d8b69aaf137db8ee0a2d7c9e6cd6383ae250.
deb259
---
deb259
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |   1 +
deb259
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c       | 224 +---------------------
deb259
 2 files changed, 2 insertions(+), 223 deletions(-)
deb259
deb259
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
deb259
index 471d83facb4a..b75ec60aa3d6 100644
deb259
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
deb259
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
deb259
@@ -739,6 +739,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
deb259
 	}
deb259
 
deb259
 	hw->netdev_features |= mvm->cfg->features;
deb259
+	hw->netdev_features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
deb259
 	if (!iwl_mvm_is_csum_supported(mvm)) {
deb259
 		hw->netdev_features &= ~(IWL_TX_CSUM_NETIF_FLAGS |
deb259
 					 NETIF_F_RXCSUM);
deb259
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
deb259
index 0c2aabc842f9..43d29335db57 100644
deb259
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
deb259
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
deb259
@@ -814,197 +814,6 @@ unsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm,
deb259
 		     mvm->fwrt.smem_cfg.lmac[lmac].txfifo_size[txf] - 256);
deb259
 }
deb259
 
deb259
-#ifdef CONFIG_INET
deb259
-
deb259
-static int
deb259
-iwl_mvm_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes,
deb259
-		       netdev_features_t netdev_flags,
deb259
-		       struct sk_buff_head *mpdus_skb)
deb259
-{
deb259
-	struct sk_buff *tmp, *next;
deb259
-	struct ieee80211_hdr *hdr = (void *)skb->data;
deb259
-	char cb[sizeof(skb->cb)];
deb259
-	u16 i = 0;
deb259
-	unsigned int tcp_payload_len;
deb259
-	unsigned int mss = skb_shinfo(skb)->gso_size;
deb259
-	bool ipv4 = (skb->protocol == htons(ETH_P_IP));
deb259
-	u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0;
deb259
-
deb259
-	skb_shinfo(skb)->gso_size = num_subframes * mss;
deb259
-	memcpy(cb, skb->cb, sizeof(cb));
deb259
-
deb259
-	next = skb_gso_segment(skb, netdev_flags);
deb259
-	skb_shinfo(skb)->gso_size = mss;
deb259
-	if (WARN_ON_ONCE(IS_ERR(next)))
deb259
-		return -EINVAL;
deb259
-	else if (next)
deb259
-		consume_skb(skb);
deb259
-
deb259
-	while (next) {
deb259
-		tmp = next;
deb259
-		next = tmp->next;
deb259
-
deb259
-		memcpy(tmp->cb, cb, sizeof(tmp->cb));
deb259
-		/*
deb259
-		 * Compute the length of all the data added for the A-MSDU.
deb259
-		 * This will be used to compute the length to write in the TX
deb259
-		 * command. We have: SNAP + IP + TCP for n -1 subframes and
deb259
-		 * ETH header for n subframes.
deb259
-		 */
deb259
-		tcp_payload_len = skb_tail_pointer(tmp) -
deb259
-			skb_transport_header(tmp) -
deb259
-			tcp_hdrlen(tmp) + tmp->data_len;
deb259
-
deb259
-		if (ipv4)
deb259
-			ip_hdr(tmp)->id = htons(ip_base_id + i * num_subframes);
deb259
-
deb259
-		if (tcp_payload_len > mss) {
deb259
-			skb_shinfo(tmp)->gso_size = mss;
deb259
-		} else {
deb259
-			if (ieee80211_is_data_qos(hdr->frame_control)) {
deb259
-				u8 *qc;
deb259
-
deb259
-				if (ipv4)
deb259
-					ip_send_check(ip_hdr(tmp));
deb259
-
deb259
-				qc = ieee80211_get_qos_ctl((void *)tmp->data);
deb259
-				*qc &= ~IEEE80211_QOS_CTL_A_MSDU_PRESENT;
deb259
-			}
deb259
-			skb_shinfo(tmp)->gso_size = 0;
deb259
-		}
deb259
-
deb259
-		tmp->prev = NULL;
deb259
-		tmp->next = NULL;
deb259
-
deb259
-		__skb_queue_tail(mpdus_skb, tmp);
deb259
-		i++;
deb259
-	}
deb259
-
deb259
-	return 0;
deb259
-}
deb259
-
deb259
-static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
deb259
-			  struct ieee80211_tx_info *info,
deb259
-			  struct ieee80211_sta *sta,
deb259
-			  struct sk_buff_head *mpdus_skb)
deb259
-{
deb259
-	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
deb259
-	struct ieee80211_hdr *hdr = (void *)skb->data;
deb259
-	unsigned int mss = skb_shinfo(skb)->gso_size;
deb259
-	unsigned int num_subframes, tcp_payload_len, subf_len, max_amsdu_len;
deb259
-	u16 snap_ip_tcp, pad;
deb259
-	unsigned int dbg_max_amsdu_len;
deb259
-	netdev_features_t netdev_flags = NETIF_F_CSUM_MASK | NETIF_F_SG;
deb259
-	u8 tid;
deb259
-
deb259
-	snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) +
deb259
-		tcp_hdrlen(skb);
deb259
-
deb259
-	dbg_max_amsdu_len = READ_ONCE(mvm->max_amsdu_len);
deb259
-
deb259
-	if (!mvmsta->max_amsdu_len ||
deb259
-	    !ieee80211_is_data_qos(hdr->frame_control) ||
deb259
-	    (!mvmsta->amsdu_enabled && !dbg_max_amsdu_len))
deb259
-		return iwl_mvm_tx_tso_segment(skb, 1, netdev_flags, mpdus_skb);
deb259
-
deb259
-	/*
deb259
-	 * Do not build AMSDU for IPv6 with extension headers.
deb259
-	 * ask stack to segment and checkum the generated MPDUs for us.
deb259
-	 */
deb259
-	if (skb->protocol == htons(ETH_P_IPV6) &&
deb259
-	    ((struct ipv6hdr *)skb_network_header(skb))->nexthdr !=
deb259
-	    IPPROTO_TCP) {
deb259
-		netdev_flags &= ~NETIF_F_CSUM_MASK;
deb259
-		return iwl_mvm_tx_tso_segment(skb, 1, netdev_flags, mpdus_skb);
deb259
-	}
deb259
-
deb259
-	tid = ieee80211_get_tid(hdr);
deb259
-	if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT))
deb259
-		return -EINVAL;
deb259
-
deb259
-	/*
deb259
-	 * No need to lock amsdu_in_ampdu_allowed since it can't be modified
deb259
-	 * during an BA session.
deb259
-	 */
deb259
-	if (info->flags & IEEE80211_TX_CTL_AMPDU &&
deb259
-	    !mvmsta->tid_data[tid].amsdu_in_ampdu_allowed)
deb259
-		return iwl_mvm_tx_tso_segment(skb, 1, netdev_flags, mpdus_skb);
deb259
-
deb259
-	if (iwl_mvm_vif_low_latency(iwl_mvm_vif_from_mac80211(mvmsta->vif)) ||
deb259
-	    !(mvmsta->amsdu_enabled & BIT(tid)))
deb259
-		return iwl_mvm_tx_tso_segment(skb, 1, netdev_flags, mpdus_skb);
deb259
-
deb259
-	max_amsdu_len = iwl_mvm_max_amsdu_size(mvm, sta, tid);
deb259
-
deb259
-	if (unlikely(dbg_max_amsdu_len))
deb259
-		max_amsdu_len = min_t(unsigned int, max_amsdu_len,
deb259
-				      dbg_max_amsdu_len);
deb259
-
deb259
-	/*
deb259
-	 * Limit A-MSDU in A-MPDU to 4095 bytes when VHT is not
deb259
-	 * supported. This is a spec requirement (IEEE 802.11-2015
deb259
-	 * section 8.7.3 NOTE 3).
deb259
-	 */
deb259
-	if (info->flags & IEEE80211_TX_CTL_AMPDU &&
deb259
-	    !sta->vht_cap.vht_supported)
deb259
-		max_amsdu_len = min_t(unsigned int, max_amsdu_len, 4095);
deb259
-
deb259
-	/* Sub frame header + SNAP + IP header + TCP header + MSS */
deb259
-	subf_len = sizeof(struct ethhdr) + snap_ip_tcp + mss;
deb259
-	pad = (4 - subf_len) & 0x3;
deb259
-
deb259
-	/*
deb259
-	 * If we have N subframes in the A-MSDU, then the A-MSDU's size is
deb259
-	 * N * subf_len + (N - 1) * pad.
deb259
-	 */
deb259
-	num_subframes = (max_amsdu_len + pad) / (subf_len + pad);
deb259
-
deb259
-	if (sta->max_amsdu_subframes &&
deb259
-	    num_subframes > sta->max_amsdu_subframes)
deb259
-		num_subframes = sta->max_amsdu_subframes;
deb259
-
deb259
-	tcp_payload_len = skb_tail_pointer(skb) - skb_transport_header(skb) -
deb259
-		tcp_hdrlen(skb) + skb->data_len;
deb259
-
deb259
-	/*
deb259
-	 * Make sure we have enough TBs for the A-MSDU:
deb259
-	 *	2 for each subframe
deb259
-	 *	1 more for each fragment
deb259
-	 *	1 more for the potential data in the header
deb259
-	 */
deb259
-	if ((num_subframes * 2 + skb_shinfo(skb)->nr_frags + 1) >
deb259
-	    mvm->trans->max_skb_frags)
deb259
-		num_subframes = 1;
deb259
-
deb259
-	if (num_subframes > 1)
deb259
-		*ieee80211_get_qos_ctl(hdr) |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
deb259
-
deb259
-	/* This skb fits in one single A-MSDU */
deb259
-	if (num_subframes * mss >= tcp_payload_len) {
deb259
-		__skb_queue_tail(mpdus_skb, skb);
deb259
-		return 0;
deb259
-	}
deb259
-
deb259
-	/*
deb259
-	 * Trick the segmentation function to make it
deb259
-	 * create SKBs that can fit into one A-MSDU.
deb259
-	 */
deb259
-	return iwl_mvm_tx_tso_segment(skb, num_subframes, netdev_flags,
deb259
-				      mpdus_skb);
deb259
-}
deb259
-#else /* CONFIG_INET */
deb259
-static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
deb259
-			  struct ieee80211_tx_info *info,
deb259
-			  struct ieee80211_sta *sta,
deb259
-			  struct sk_buff_head *mpdus_skb)
deb259
-{
deb259
-	/* Impossible to get TSO with CONFIG_INET */
deb259
-	WARN_ON(1);
deb259
-
deb259
-	return -1;
deb259
-}
deb259
-#endif
deb259
-
deb259
 /* Check if there are any timed-out TIDs on a given shared TXQ */
deb259
 static bool iwl_mvm_txq_should_update(struct iwl_mvm *mvm, int txq_id)
deb259
 {
deb259
@@ -1203,9 +1012,6 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
deb259
 {
deb259
 	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
deb259
 	struct ieee80211_tx_info info;
deb259
-	struct sk_buff_head mpdus_skbs;
deb259
-	unsigned int payload_len;
deb259
-	int ret;
deb259
 
deb259
 	if (WARN_ON_ONCE(!mvmsta))
deb259
 		return -1;
deb259
@@ -1215,35 +1021,7 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
deb259
 
deb259
 	memcpy(&info, skb->cb, sizeof(info));
deb259
 
deb259
-	if (!skb_is_gso(skb))
deb259
-		return iwl_mvm_tx_mpdu(mvm, skb, &info, sta);
deb259
-
deb259
-	payload_len = skb_tail_pointer(skb) - skb_transport_header(skb) -
deb259
-		tcp_hdrlen(skb) + skb->data_len;
deb259
-
deb259
-	if (payload_len <= skb_shinfo(skb)->gso_size)
deb259
-		return iwl_mvm_tx_mpdu(mvm, skb, &info, sta);
deb259
-
deb259
-	__skb_queue_head_init(&mpdus_skbs);
deb259
-
deb259
-	ret = iwl_mvm_tx_tso(mvm, skb, &info, sta, &mpdus_skbs);
deb259
-	if (ret)
deb259
-		return ret;
deb259
-
deb259
-	if (WARN_ON(skb_queue_empty(&mpdus_skbs)))
deb259
-		return ret;
deb259
-
deb259
-	while (!skb_queue_empty(&mpdus_skbs)) {
deb259
-		skb = __skb_dequeue(&mpdus_skbs);
deb259
-
deb259
-		ret = iwl_mvm_tx_mpdu(mvm, skb, &info, sta);
deb259
-		if (ret) {
deb259
-			__skb_queue_purge(&mpdus_skbs);
deb259
-			return ret;
deb259
-		}
deb259
-	}
deb259
-
deb259
-	return 0;
deb259
+	return iwl_mvm_tx_mpdu(mvm, skb, &info, sta);
deb259
 }
deb259
 
deb259
 static void iwl_mvm_check_ratid_empty(struct iwl_mvm *mvm,
deb259
-- 
deb259
2.13.6
deb259