Commit f7992a04 authored by Luke Triantafyllidis's avatar Luke Triantafyllidis Committed by Greg Kroah-Hartman
Browse files

staging: rtlwifi: refactor rtl_get_tcb_desc



Refactored rtl_get_tcb_desc slightly to stay within the 80 character
line limit.

Signed-off-by: default avatarLuke Triantafyllidis <ltriant@cpan.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e083926b
Loading
Loading
Loading
Loading
+48 −54
Original line number Diff line number Diff line
@@ -1236,9 +1236,18 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
	if (rtl_is_tx_report_skb(hw, skb))
		tcb_desc->use_spe_rpt = 1;

	if (ieee80211_is_data(fc)) {
	if (!ieee80211_is_data(fc)) {
		tcb_desc->use_driver_rate = true;
		tcb_desc->ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
		tcb_desc->disable_ratefallback = 1;
		tcb_desc->mac_id = 0;
		tcb_desc->packet_bw = false;

		return;
	}

	/*
		 *we set data rate INX 0
	 * We set data rate INX 0
	 * in rtl_rc.c if skb is special data or
	 * mgt which need low data rate.
	 */
@@ -1247,37 +1256,29 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
	 * So tcb_desc->hw_rate is just used for
	 * special data and mgt frames
	 */
		if (info->control.rates[0].idx == 0 ||
		    ieee80211_is_nullfunc(fc)) {
	if (info->control.rates[0].idx == 0 || ieee80211_is_nullfunc(fc)) {
		tcb_desc->use_driver_rate = true;
			tcb_desc->ratr_index =
					SET_RATE_ID(RATR_INX_WIRELESS_MC);
		tcb_desc->ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);

		tcb_desc->disable_ratefallback = 1;
		} else {
			/* because hw will never use hw_rate
	} else if (sta && sta->vht_cap.vht_supported) {
		/*
		 * Because hw will never use hw_rate
		 * when tcb_desc->use_driver_rate = false
		 * so we never set highest N rate here,
		 * and N rate will all be controlled by FW
		 * when tcb_desc->use_driver_rate = false
		 */
			if (sta && sta->vht_cap.vht_supported) {
				tcb_desc->hw_rate =
				_rtl_get_vht_highest_n_rate(hw, sta);
			} else {
				if (sta && sta->ht_cap.ht_supported) {
					tcb_desc->hw_rate =
					    _rtl_get_highest_n_rate(hw, sta);
				} else {
					if (rtlmac->mode == WIRELESS_MODE_B) {
						tcb_desc->hw_rate =
						    rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M];
		tcb_desc->hw_rate = _rtl_get_vht_highest_n_rate(hw, sta);
	} else if (sta && sta->ht_cap.ht_supported) {
		tcb_desc->hw_rate = _rtl_get_highest_n_rate(hw, sta);
	} else {
						tcb_desc->hw_rate =
						    rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M];
					}
				}
			}
		enum rtl_var_map var = RTL_RC_OFDM_RATE54M;

		if (rtlmac->mode == WIRELESS_MODE_B)
			var = RTL_RC_CCK_RATE11M;

		tcb_desc->hw_rate = rtlpriv->cfg->maps[var];
	}

	if (is_multicast_ether_addr(hdr->addr1))
@@ -1290,13 +1291,6 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
	_rtl_qurey_shortpreamble_mode(hw, tcb_desc, info);
	_rtl_query_shortgi(hw, sta, tcb_desc, info);
	_rtl_query_protection_mode(hw, tcb_desc, info);
	} else {
		tcb_desc->use_driver_rate = true;
		tcb_desc->ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
		tcb_desc->disable_ratefallback = 1;
		tcb_desc->mac_id = 0;
		tcb_desc->packet_bw = false;
	}
#undef SET_RATE_ID
}