Tony Chuang <yhchuang@xxxxxxxxxxx> 於 2019年10月23日 上午10:37 寫道: >> [mailto:linux-wireless-owner@xxxxxxxxxxxxxxx] On Behalf >>> Of Chris Chiu >>> Sent: Tuesday, October 22, 2019 8:49 PM >>> To: Tony Chuang >>> Cc: Kalle Valo; linux-wireless; Brian Norris >>> Subject: Re: [PATCH v3 4/5] rtw88: add set_bitrate_mask support >>> >>>> On Tue, Oct 22, 2019 at 6:04 PM <yhchuang@xxxxxxxxxxx> wrote: >>>> >>>> From: Tzu-En Huang <tehuang@xxxxxxxxxxx> >>>> >>>> Support setting bit rate from upper layer. >>>> After configuring the original rate control result in the driver, the >>>> result is then masked by the bit rate mask received from the ops >>>> set_bitrate_mask. Lastly, the masked result will be sent to firmware. >>>> >>>> Signed-off-by: Tzu-En Huang <tehuang@xxxxxxxxxxx> >>>> Signed-off-by: Yan-Hsuan Chuang <yhchuang@xxxxxxxxxxx> Reviewed-by: Chris Chiu <chiu@xxxxxxxxxxxx> >>>> --- >>>> >>>> v1 -> v2 >>>> * No change >>>> >>>> v2 -> v3 >>>> * use u64_encode_bits >>>> >>>> +static u64 rtw_update_rate_mask(struct rtw_dev *rtwdev, >>>> + struct rtw_sta_info *si, >>>> + u64 ra_mask, bool is_vht_enable, >>>> + u8 wireless_set) >>>> +{ >>>> + struct rtw_hal *hal = &rtwdev->hal; >>>> + const struct cfg80211_bitrate_mask *mask = si->mask; >>>> + u64 cfg_mask = GENMASK(63, 0); >>>> + u8 rssi_level, band; >>>> + >>>> + if (wireless_set != WIRELESS_CCK) { >>>> + rssi_level = si->rssi_level; >>>> + if (rssi_level == 0) >>>> + ra_mask &= 0xffffffffffffffffULL; >>>> + else if (rssi_level == 1) >>>> + ra_mask &= 0xfffffffffffffff0ULL; >>>> + else if (rssi_level == 2) >>>> + ra_mask &= 0xffffffffffffefe0ULL; >>>> + else if (rssi_level == 3) >>>> + ra_mask &= 0xffffffffffffcfc0ULL; >>>> + else if (rssi_level == 4) >>>> + ra_mask &= 0xffffffffffff8f80ULL; >>>> + else if (rssi_level >= 5) >>>> + ra_mask &= 0xffffffffffff0f00ULL; >>>> + } >>> >>> Would be better to enumerate rssi_level instead of 0 to 5. Does level >>> 0 means bad rssi or good? >>> > > I think 0 is the lowest level. And I think we don't need to add an enum for > this kind of levels, as the number just presents the meaning of it. > > Yan-Hsuan OK. I think it also makes sense to me. Chris