drivers/net/wireless/realtek/rtlwifi/rc.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/rc.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/realtek/rtlwifi/rc.c
Extension
.c
Size
8223 bytes
Lines
319
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (rtlhal->current_bandtype == BAND_ON_2_4G) {
			if (wireless_mode == WIRELESS_MODE_B) {
				return B_MODE_MAX_RIX;
			} else if (wireless_mode == WIRELESS_MODE_G) {
				return G_MODE_MAX_RIX;
			} else if (wireless_mode == WIRELESS_MODE_N_24G) {
				if (nss == 1)
					return N_MODE_MCS7_RIX;
				else
					return N_MODE_MCS15_RIX;
			} else if (wireless_mode == WIRELESS_MODE_AC_24G) {
				if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) {
					ieee80211_rate_set_vht(&rate,
							       AC_MODE_MCS8_RIX,
							       nss);
					goto out;
				} else {
					ieee80211_rate_set_vht(&rate,
							       AC_MODE_MCS9_RIX,
							       nss);
					goto out;
				}
			}
			return 0;
		} else {
			if (wireless_mode == WIRELESS_MODE_A) {
				return A_MODE_MAX_RIX;
			} else if (wireless_mode == WIRELESS_MODE_N_5G) {
				if (nss == 1)
					return N_MODE_MCS7_RIX;
				else
					return N_MODE_MCS15_RIX;
			} else if (wireless_mode == WIRELESS_MODE_AC_5G) {
				if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) {
					ieee80211_rate_set_vht(&rate,
							       AC_MODE_MCS8_RIX,
							       nss);
					goto out;
				} else {
					ieee80211_rate_set_vht(&rate,
							       AC_MODE_MCS9_RIX,
							       nss);
					goto out;
				}
			}
			return 0;
		}
	}

out:
	return rate.idx;
}

static void _rtl_rc_rate_set_series(struct rtl_priv *rtlpriv,
				    struct ieee80211_sta *sta,
				    struct ieee80211_tx_rate *rate,
				    struct ieee80211_tx_rate_control *txrc,
				    u8 tries, s8 rix, int rtsctsenable,
				    bool not_data)
{
	struct rtl_mac *mac = rtl_mac(rtlpriv);
	struct rtl_sta_info *sta_entry = NULL;
	u16 wireless_mode = 0;
	u8 sgi_20 = 0, sgi_40 = 0, sgi_80 = 0;

	if (sta) {
		sgi_20 = sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_20;
		sgi_40 = sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SGI_40;
		sgi_80 = sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80;
		sta_entry = (struct rtl_sta_info *)sta->drv_priv;
		wireless_mode = sta_entry->wireless_mode;
	}
	rate->count = tries;
	rate->idx = rix >= 0x00 ? rix : 0x00;

	if (!not_data) {
		if (txrc->short_preamble)
			rate->flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE;
		if (mac->opmode == NL80211_IFTYPE_AP ||
			mac->opmode == NL80211_IFTYPE_ADHOC) {
			if (sta && (sta->deflink.ht_cap.cap &
				    IEEE80211_HT_CAP_SUP_WIDTH_20_40))
				rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
			if (sta && sta->deflink.vht_cap.vht_supported)
				rate->flags |= IEEE80211_TX_RC_80_MHZ_WIDTH;
		} else {
			if (mac->bw_80)
				rate->flags |= IEEE80211_TX_RC_80_MHZ_WIDTH;
			else if (mac->bw_40)
				rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;

Annotation

Implementation Notes