All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
To: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 36/38] iwlwifi: mvm: rs: remove stats argument from functions
Date: Thu, 22 Jan 2015 22:33:27 +0200	[thread overview]
Message-ID: <1421958809-3371-36-git-send-email-emmanuel.grumbach@intel.com> (raw)
In-Reply-To: <1421958313.6424.2.camel@egrumbacBox>

From: Johannes Berg <johannes.berg@intel.com>

The stats argument is always only passed as &mvm->drv_rx_stats, so
there's no point in passing it when the mvm pointer is passed.
Remove the argument entirely.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/iwlwifi/mvm/mvm.h |  4 +-
 drivers/net/wireless/iwlwifi/mvm/rs.c  | 92 ++++++++++++++++++++++++++--------
 drivers/net/wireless/iwlwifi/mvm/rx.c  |  2 +-
 3 files changed, 72 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index aa93ee7..979ac23 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -1143,9 +1143,7 @@ iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 
 /* rate scaling */
 int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, bool init);
-void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm,
-				struct iwl_mvm_frame_stats *stats,
-				u32 rate, bool agg);
+void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg);
 int rs_pretty_print_rate(char *buf, const u32 rate);
 void rs_update_last_rssi(struct iwl_mvm *mvm,
 			 struct iwl_lq_sta *lq_sta,
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index f30eff2..9f32f2d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -2600,68 +2600,116 @@ static void rs_vht_set_enabled_rates(struct ieee80211_sta *sta,
 	}
 }
 
+static void rs_ht_init(struct iwl_mvm *mvm,
+		       struct ieee80211_sta *sta,
+		       struct iwl_lq_sta *lq_sta,
+		       struct ieee80211_sta_ht_cap *ht_cap)
+{
+	/* active_siso_rate mask includes 9 MBits (bit 5),
+	 * and CCK (bits 0-3), supp_rates[] does not;
+	 * shift to convert format, force 9 MBits off.
+	 */
+	lq_sta->active_siso_rate = ht_cap->mcs.rx_mask[0] << 1;
+	lq_sta->active_siso_rate |= ht_cap->mcs.rx_mask[0] & 0x1;
+	lq_sta->active_siso_rate &= ~((u16)0x2);
+	lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE;
+
+	lq_sta->active_mimo2_rate = ht_cap->mcs.rx_mask[1] << 1;
+	lq_sta->active_mimo2_rate |= ht_cap->mcs.rx_mask[1] & 0x1;
+	lq_sta->active_mimo2_rate &= ~((u16)0x2);
+	lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE;
+
+	if (mvm->cfg->ht_params->ldpc &&
+	    (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING))
+		lq_sta->ldpc = true;
+
+	if (mvm->cfg->ht_params->stbc &&
+	    (num_of_ant(iwl_mvm_get_valid_tx_ant(mvm)) > 1) &&
+	    (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC))
+		lq_sta->stbc = true;
+
+	lq_sta->is_vht = false;
+}
+
+static void rs_vht_init(struct iwl_mvm *mvm,
+			struct ieee80211_sta *sta,
+			struct iwl_lq_sta *lq_sta,
+			struct ieee80211_sta_vht_cap *vht_cap)
+{
+	rs_vht_set_enabled_rates(sta, vht_cap, lq_sta);
+
+	if (mvm->cfg->ht_params->ldpc &&
+	    (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC))
+		lq_sta->ldpc = true;
+
+	if (mvm->cfg->ht_params->stbc &&
+	    (num_of_ant(iwl_mvm_get_valid_tx_ant(mvm)) > 1) &&
+	    (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK))
+		lq_sta->stbc = true;
+
+	lq_sta->is_vht = true;
+}
+
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-static void iwl_mvm_reset_frame_stats(struct iwl_mvm *mvm,
-				      struct iwl_mvm_frame_stats *stats)
+static void iwl_mvm_reset_frame_stats(struct iwl_mvm *mvm)
 {
 	spin_lock_bh(&mvm->drv_stats_lock);
-	memset(stats, 0, sizeof(*stats));
+	memset(&mvm->drv_rx_stats, 0, sizeof(mvm->drv_rx_stats));
 	spin_unlock_bh(&mvm->drv_stats_lock);
 }
 
-void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm,
-				struct iwl_mvm_frame_stats *stats,
-				u32 rate, bool agg)
+void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg)
 {
 	u8 nss = 0, mcs = 0;
 
 	spin_lock(&mvm->drv_stats_lock);
 
 	if (agg)
-		stats->agg_frames++;
+		mvm->drv_rx_stats.agg_frames++;
 
-	stats->success_frames++;
+	mvm->drv_rx_stats.success_frames++;
 
 	switch (rate & RATE_MCS_CHAN_WIDTH_MSK) {
 	case RATE_MCS_CHAN_WIDTH_20:
-		stats->bw_20_frames++;
+		mvm->drv_rx_stats.bw_20_frames++;
 		break;
 	case RATE_MCS_CHAN_WIDTH_40:
-		stats->bw_40_frames++;
+		mvm->drv_rx_stats.bw_40_frames++;
 		break;
 	case RATE_MCS_CHAN_WIDTH_80:
-		stats->bw_80_frames++;
+		mvm->drv_rx_stats.bw_80_frames++;
 		break;
 	default:
 		WARN_ONCE(1, "bad BW. rate 0x%x", rate);
 	}
 
 	if (rate & RATE_MCS_HT_MSK) {
-		stats->ht_frames++;
+		mvm->drv_rx_stats.ht_frames++;
 		mcs = rate & RATE_HT_MCS_RATE_CODE_MSK;
 		nss = ((rate & RATE_HT_MCS_NSS_MSK) >> RATE_HT_MCS_NSS_POS) + 1;
 	} else if (rate & RATE_MCS_VHT_MSK) {
-		stats->vht_frames++;
+		mvm->drv_rx_stats.vht_frames++;
 		mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK;
 		nss = ((rate & RATE_VHT_MCS_NSS_MSK) >>
 		       RATE_VHT_MCS_NSS_POS) + 1;
 	} else {
-		stats->legacy_frames++;
+		mvm->drv_rx_stats.legacy_frames++;
 	}
 
 	if (nss == 1)
-		stats->siso_frames++;
+		mvm->drv_rx_stats.siso_frames++;
 	else if (nss == 2)
-		stats->mimo2_frames++;
+		mvm->drv_rx_stats.mimo2_frames++;
 
 	if (rate & RATE_MCS_SGI_MSK)
-		stats->sgi_frames++;
+		mvm->drv_rx_stats.sgi_frames++;
 	else
-		stats->ngi_frames++;
+		mvm->drv_rx_stats.ngi_frames++;
 
-	stats->last_rates[stats->last_frame_idx] = rate;
-	stats->last_frame_idx = (stats->last_frame_idx + 1) %
-		ARRAY_SIZE(stats->last_rates);
+	mvm->drv_rx_stats.last_rates[mvm->drv_rx_stats.last_frame_idx] = rate;
+	mvm->drv_rx_stats.last_frame_idx =
+		(mvm->drv_rx_stats.last_frame_idx + 1) %
+			ARRAY_SIZE(mvm->drv_rx_stats.last_rates);
 
 	spin_unlock(&mvm->drv_stats_lock);
 }
@@ -2749,7 +2797,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 	lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID;
 	lq_sta->is_agg = 0;
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-	iwl_mvm_reset_frame_stats(mvm, &mvm->drv_rx_stats);
+	iwl_mvm_reset_frame_stats(mvm);
 #endif
 	rs_initialize_lq(mvm, sta, lq_sta, band, init);
 }
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c
index 7919a7b..f922131 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rx.c
@@ -407,7 +407,7 @@ int iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
 	}
 
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-	iwl_mvm_update_frame_stats(mvm, &mvm->drv_rx_stats, rate_n_flags,
+	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,
-- 
1.9.1


  parent reply	other threads:[~2015-01-22 20:34 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 20:25 pull request: iwlwifi-next 2015-01-22 Grumbach, Emmanuel
2015-01-22 20:32 ` [PATCH 01/38] iwlwifi: mvm: don't indicate no BA if STA was in powersave Emmanuel Grumbach
2015-01-22 20:32 ` [PATCH 02/38] iwlwifi: mvm: rs: repeat initial legacy rates in LQ table Emmanuel Grumbach
2015-01-22 20:32 ` [PATCH 03/38] iwlwifi: mvm: make sure state isn't in d0i3 when collecting fw dbg Emmanuel Grumbach
2015-01-22 20:32 ` [PATCH 04/38] iwlwifi: add new config and PCI IDs for 4165 series Emmanuel Grumbach
2015-01-22 20:32 ` [PATCH 05/38] iwlwifi: mvm: Add debugfs entry to enable scan offload notification Emmanuel Grumbach
2015-01-22 20:32 ` [PATCH 06/38] iwlwifi: mvm: make sure state isn't in d0i3 when stopping fw monitor Emmanuel Grumbach
2015-01-22 20:32 ` [PATCH 07/38] iwlwifi: mvm: allow to collect debug data from non-sleepable context Emmanuel Grumbach
2015-01-22 20:32 ` [PATCH 08/38] iwlwifi: mvm: rs: allow to disable MIMO for P2P only Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 09/38] iwlwifi: mvm: set max_out_time equal to frag_passive_dwell in fragmented scan Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 10/38] iwlwifi: mvm: add print of he nvm version Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 11/38] iwlwifi: remove unused TLV capability flags Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 12/38] iwlwifi: mvm: scan dwell time corrections Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 13/38] iwlwifi: mvm: let the firmware configure the scheduler Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 14/38] iwlwifi: mvm: add debugfs file for misbehaving U-APSD AP Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 15/38] iwlwifi: mvm: add support for dumping a secondary SRAM Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 16/38] iwlwifi: mvm: add rxf and txf to dump data Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 17/38] iwlwifi: correctly set the NMI register Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 18/38] iwlwifi: mvm: sync statistics firmware API Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 19/38] iwlwifi: mvm: move statistics API to new header file Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 20/38] iwlwifi: mvm: generate statistics debugfs code Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 21/38] iwlwifi: mvm: rs: cleanup unuseful and overflowing traces Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 22/38] iwlwifi: mvm: ignore temperature updates in the RX statistics notification Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 23/38] iwlwifi: mvm: move U-APSD decision to authentication Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 24/38] iwlwifi: mvm: BT Coex - fine tune the MPLUT register Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 25/38] iwlwifi: mvm: add support for new LTR command Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 26/38] Revert "iwlwifi: mvm: drop non VO frames when flushing" Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 27/38] iwlwifi: mvm: rs: use STBC regardless of power save mode Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 28/38] iwlwifi: mvm: document switch case fall-through in iwl_mvm_send_sta_key Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 29/38] iwlwifi: pcie: init ref_lock Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 30/38] iwlwifi: mvm: support family 8000 C step Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 31/38] iwlwifi: mvm: BT Coex - set all the co-running values to 0 Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 32/38] iwlwifi: mvm: Do not consider invalid HW queues in queue mask Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 33/38] iwlwifi: mvm: really disable TDLS queues Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 34/38] iwlwifi: mvm: rs: refactor ht/vht init Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 35/38] iwlwifi: mvm: use a new API for enabling STBC Emmanuel Grumbach
2015-01-22 20:33 ` Emmanuel Grumbach [this message]
2015-01-22 20:33 ` [PATCH 37/38] iwlwifi: pcie: support secured boot flow for family 8000 B step Emmanuel Grumbach
2015-01-22 20:33 ` [PATCH 38/38] iwlwifi: mvm: fix rx chains configuration in phy ctxt cmd Emmanuel Grumbach
2015-01-23 15:56 ` pull request: iwlwifi-next 2015-01-22 Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421958809-3371-36-git-send-email-emmanuel.grumbach@intel.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.