phy.c (57cafeb18f06d3f4eaea9145d3396fdb8c699acc) | phy.c (5c152231c341f0ea00b3ebd64cf6718b10106dab) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2/* Copyright(c) 2019-2020 Realtek Corporation 3 */ 4 5#include "coex.h" 6#include "debug.h" 7#include "fw.h" 8#include "mac.h" --- 2233 unchanged lines hidden (view full) --- 2242static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta) 2243{ 2244 struct rtw89_phy_iter_ra_data *ra_data = (struct rtw89_phy_iter_ra_data *)data; 2245 struct rtw89_dev *rtwdev = ra_data->rtwdev; 2246 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; 2247 const struct rtw89_c2h_ra_rpt *c2h = 2248 (const struct rtw89_c2h_ra_rpt *)ra_data->c2h->data; 2249 struct rtw89_ra_report *ra_report = &rtwsta->ra_report; | 1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2/* Copyright(c) 2019-2020 Realtek Corporation 3 */ 4 5#include "coex.h" 6#include "debug.h" 7#include "fw.h" 8#include "mac.h" --- 2233 unchanged lines hidden (view full) --- 2242static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta) 2243{ 2244 struct rtw89_phy_iter_ra_data *ra_data = (struct rtw89_phy_iter_ra_data *)data; 2245 struct rtw89_dev *rtwdev = ra_data->rtwdev; 2246 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv; 2247 const struct rtw89_c2h_ra_rpt *c2h = 2248 (const struct rtw89_c2h_ra_rpt *)ra_data->c2h->data; 2249 struct rtw89_ra_report *ra_report = &rtwsta->ra_report; |
2250 const struct rtw89_chip_info *chip = rtwdev->chip; 2251 bool format_v1 = chip->chip_gen == RTW89_CHIP_BE; |
|
2250 u8 mode, rate, bw, giltf, mac_id; 2251 u16 legacy_bitrate; 2252 bool valid; 2253 u8 mcs = 0; | 2252 u8 mode, rate, bw, giltf, mac_id; 2253 u16 legacy_bitrate; 2254 bool valid; 2255 u8 mcs = 0; |
2256 u8 t; |
|
2254 2255 mac_id = le32_get_bits(c2h->w2, RTW89_C2H_RA_RPT_W2_MACID); 2256 if (mac_id != rtwsta->mac_id) 2257 return; 2258 2259 rate = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_MCSNSS); 2260 bw = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_BW); 2261 giltf = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_GILTF); 2262 mode = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_MD_SEL); 2263 | 2257 2258 mac_id = le32_get_bits(c2h->w2, RTW89_C2H_RA_RPT_W2_MACID); 2259 if (mac_id != rtwsta->mac_id) 2260 return; 2261 2262 rate = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_MCSNSS); 2263 bw = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_BW); 2264 giltf = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_GILTF); 2265 mode = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_MD_SEL); 2266 |
2267 if (format_v1) { 2268 t = le32_get_bits(c2h->w2, RTW89_C2H_RA_RPT_W2_MCSNSS_B7); 2269 rate |= u8_encode_bits(t, BIT(7)); 2270 t = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_BW_B2); 2271 bw |= u8_encode_bits(t, BIT(2)); 2272 t = le32_get_bits(c2h->w3, RTW89_C2H_RA_RPT_W3_MD_SEL_B2); 2273 mode |= u8_encode_bits(t, BIT(2)); 2274 } 2275 |
|
2264 if (mode == RTW89_RA_RPT_MODE_LEGACY) { 2265 valid = rtw89_ra_report_to_bitrate(rtwdev, rate, &legacy_bitrate); 2266 if (!valid) 2267 return; 2268 } 2269 2270 memset(&ra_report->txrate, 0, sizeof(ra_report->txrate)); 2271 --- 10 unchanged lines hidden (view full) --- 2282 rate = FIELD_GET(RTW89_RA_RATE_MASK_HT_MCS, rate); 2283 ra_report->txrate.mcs = rate; 2284 if (giltf) 2285 ra_report->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 2286 mcs = ra_report->txrate.mcs & 0x07; 2287 break; 2288 case RTW89_RA_RPT_MODE_VHT: 2289 ra_report->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; | 2276 if (mode == RTW89_RA_RPT_MODE_LEGACY) { 2277 valid = rtw89_ra_report_to_bitrate(rtwdev, rate, &legacy_bitrate); 2278 if (!valid) 2279 return; 2280 } 2281 2282 memset(&ra_report->txrate, 0, sizeof(ra_report->txrate)); 2283 --- 10 unchanged lines hidden (view full) --- 2294 rate = FIELD_GET(RTW89_RA_RATE_MASK_HT_MCS, rate); 2295 ra_report->txrate.mcs = rate; 2296 if (giltf) 2297 ra_report->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 2298 mcs = ra_report->txrate.mcs & 0x07; 2299 break; 2300 case RTW89_RA_RPT_MODE_VHT: 2301 ra_report->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
2290 ra_report->txrate.mcs = FIELD_GET(RTW89_RA_RATE_MASK_MCS, rate); 2291 ra_report->txrate.nss = FIELD_GET(RTW89_RA_RATE_MASK_NSS, rate) + 1; | 2302 ra_report->txrate.mcs = format_v1 ? 2303 u8_get_bits(rate, RTW89_RA_RATE_MASK_MCS_V1) : 2304 u8_get_bits(rate, RTW89_RA_RATE_MASK_MCS); 2305 ra_report->txrate.nss = format_v1 ? 2306 u8_get_bits(rate, RTW89_RA_RATE_MASK_NSS_V1) + 1 : 2307 u8_get_bits(rate, RTW89_RA_RATE_MASK_NSS) + 1; |
2292 if (giltf) 2293 ra_report->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 2294 mcs = ra_report->txrate.mcs; 2295 break; 2296 case RTW89_RA_RPT_MODE_HE: 2297 ra_report->txrate.flags |= RATE_INFO_FLAGS_HE_MCS; | 2308 if (giltf) 2309 ra_report->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 2310 mcs = ra_report->txrate.mcs; 2311 break; 2312 case RTW89_RA_RPT_MODE_HE: 2313 ra_report->txrate.flags |= RATE_INFO_FLAGS_HE_MCS; |
2298 ra_report->txrate.mcs = FIELD_GET(RTW89_RA_RATE_MASK_MCS, rate); 2299 ra_report->txrate.nss = FIELD_GET(RTW89_RA_RATE_MASK_NSS, rate) + 1; | 2314 ra_report->txrate.mcs = format_v1 ? 2315 u8_get_bits(rate, RTW89_RA_RATE_MASK_MCS_V1) : 2316 u8_get_bits(rate, RTW89_RA_RATE_MASK_MCS); 2317 ra_report->txrate.nss = format_v1 ? 2318 u8_get_bits(rate, RTW89_RA_RATE_MASK_NSS_V1) + 1 : 2319 u8_get_bits(rate, RTW89_RA_RATE_MASK_NSS) + 1; |
2300 if (giltf == RTW89_GILTF_2XHE08 || giltf == RTW89_GILTF_1XHE08) 2301 ra_report->txrate.he_gi = NL80211_RATE_INFO_HE_GI_0_8; 2302 else if (giltf == RTW89_GILTF_2XHE16 || giltf == RTW89_GILTF_1XHE16) 2303 ra_report->txrate.he_gi = NL80211_RATE_INFO_HE_GI_1_6; 2304 else 2305 ra_report->txrate.he_gi = NL80211_RATE_INFO_HE_GI_3_2; 2306 mcs = ra_report->txrate.mcs; 2307 break; 2308 } 2309 2310 ra_report->txrate.bw = rtw89_hw_to_rate_info_bw(bw); 2311 ra_report->bit_rate = cfg80211_calculate_bitrate(&ra_report->txrate); | 2320 if (giltf == RTW89_GILTF_2XHE08 || giltf == RTW89_GILTF_1XHE08) 2321 ra_report->txrate.he_gi = NL80211_RATE_INFO_HE_GI_0_8; 2322 else if (giltf == RTW89_GILTF_2XHE16 || giltf == RTW89_GILTF_1XHE16) 2323 ra_report->txrate.he_gi = NL80211_RATE_INFO_HE_GI_1_6; 2324 else 2325 ra_report->txrate.he_gi = NL80211_RATE_INFO_HE_GI_3_2; 2326 mcs = ra_report->txrate.mcs; 2327 break; 2328 } 2329 2330 ra_report->txrate.bw = rtw89_hw_to_rate_info_bw(bw); 2331 ra_report->bit_rate = cfg80211_calculate_bitrate(&ra_report->txrate); |
2312 ra_report->hw_rate = FIELD_PREP(RTW89_HW_RATE_MASK_MOD, mode) | 2313 FIELD_PREP(RTW89_HW_RATE_MASK_VAL, rate); | 2332 ra_report->hw_rate = format_v1 ? 2333 u16_encode_bits(mode, RTW89_HW_RATE_V1_MASK_MOD) | 2334 u16_encode_bits(rate, RTW89_HW_RATE_V1_MASK_VAL) : 2335 u16_encode_bits(mode, RTW89_HW_RATE_MASK_MOD) | 2336 u16_encode_bits(rate, RTW89_HW_RATE_MASK_VAL); |
2314 ra_report->might_fallback_legacy = mcs <= 2; 2315 sta->deflink.agg.max_rc_amsdu_len = get_max_amsdu_len(rtwdev, ra_report); 2316 rtwsta->max_agg_wait = sta->deflink.agg.max_rc_amsdu_len / 1500 - 1; 2317} 2318 2319static void 2320rtw89_phy_c2h_ra_rpt(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len) 2321{ --- 2376 unchanged lines hidden --- | 2337 ra_report->might_fallback_legacy = mcs <= 2; 2338 sta->deflink.agg.max_rc_amsdu_len = get_max_amsdu_len(rtwdev, ra_report); 2339 rtwsta->max_agg_wait = sta->deflink.agg.max_rc_amsdu_len / 1500 - 1; 2340} 2341 2342static void 2343rtw89_phy_c2h_ra_rpt(struct rtw89_dev *rtwdev, struct sk_buff *c2h, u32 len) 2344{ --- 2376 unchanged lines hidden --- |