Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1816f17 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo
Browse files

rtlwifi: Add rtl_get_hal_edca_param() to generate register's format of EDCA.



Convert from the value of ieee80211_tx_queue_params to Realtek's
register value.

Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent cdc9c7a0
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -1557,6 +1557,42 @@ void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms)
			 "Wait 1ms (%d/%d) to disable key.\n", i, wait_ms);
	}
}

u32 rtl_get_hal_edca_param(struct ieee80211_hw *hw,
			   struct ieee80211_vif *vif,
			   enum wireless_mode wirelessmode,
			   struct ieee80211_tx_queue_params *param)
{
	u32 reg = 0;
	u8 sifstime = 10;
	u8 slottime = 20;

	/* AIFS = AIFSN * slot time + SIFS */
	switch (wirelessmode) {
	case WIRELESS_MODE_A:
	case WIRELESS_MODE_N_24G:
	case WIRELESS_MODE_N_5G:
	case WIRELESS_MODE_AC_5G:
	case WIRELESS_MODE_AC_24G:
		sifstime = 16;
		slottime = 9;
		break;
	case WIRELESS_MODE_G:
		slottime = (vif->bss_conf.use_short_slot ? 9 : 20);
		break;
	default:
		break;
	}

	reg |= (param->txop & 0x7FF) << 16;
	reg |= (fls(param->cw_max) & 0xF) << 12;
	reg |= (fls(param->cw_min) & 0xF) << 8;
	reg |= (param->aifs & 0x0F) * slottime + sifstime;

	return reg;
}
EXPORT_SYMBOL_GPL(rtl_get_hal_edca_param);

/*********************************************************
 *
 * functions called by core.c
+4 −0
Original line number Diff line number Diff line
@@ -137,6 +137,10 @@ void rtl_tx_report_handler(struct ieee80211_hw *hw, u8 *tmp_buf,
			   u8 c2h_cmd_len);
bool rtl_check_tx_report_acked(struct ieee80211_hw *hw);
void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms);
u32 rtl_get_hal_edca_param(struct ieee80211_hw *hw,
			   struct ieee80211_vif *vif,
			   enum wireless_mode wirelessmode,
			   struct ieee80211_tx_queue_params *param);

void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb);