Search Linux Wireless

Re: [PATCH RFC/RFT 2/4] mac80211: Add API function to set the last TX bitrate for a station

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Berg <johannes@xxxxxxxxxxxxxxxx> writes:

> On Thu, 2019-09-19 at 14:22 +0200, Toke Høiland-Jørgensen wrote:
>
> Given a ULL constant:
>
>> +/* constants for calculating reciprocals to avoid division in fast path */
>> +#define IEEE80211_RECIPROCAL_DIVISOR 0x100000000ULL
>
> [...]
>
>> +void ieee80211_sta_set_last_tx_bitrate(struct ieee80211_sta *pubsta,
>> +				       u32 rate)
>> +{
>> +	struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
>> +
>> +	sta->last_tx_bitrate = rate;
>> +	sta->last_tx_bitrate_reciprocal = ((u64)IEEE80211_RECIPROCAL_DIVISOR / rate);
>
> that cast seems unnecessary?

Yeah. I only remembered to make it a ULL constant later, and forgot to
remove the cast. But I guess this should be using do_div() anyway...

-Toke





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux