Search Linux Wireless

Re: [PATCH 03/24] rtw89: add core and trx files

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

 



Hi,

On Fri, Jun 18, 2021 at 02:46:04PM +0800, Ping-Ke Shih wrote:
> --- /dev/null
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -0,0 +1,2359 @@
> +static void rtw89_traffic_stats_calc(struct rtw89_dev *rtwdev,
> +				     struct rtw89_traffic_stats *stats)
> +{
...
> +	stats->tx_avg_len = (u32)(stats->tx_cnt ? stats->tx_unicast / stats->tx_cnt : 0);
> +	stats->rx_avg_len = (u32)(stats->rx_cnt ? stats->rx_unicast / stats->rx_cnt : 0);

You're doing 64-bit division which isn't supported on all architectures.
You need a do_div()-based solution here, like:

	stats->tx_avg_len = stats->tx_cnt
			    ? DIV_ROUND_DOWN_ULL(stats->tx_unicast, stats->tx_cnt)
			    : 0;
	stats->rx_avg_len = stats->rx_cnt
			    ? DIV_ROUND_DOWN_ULL(stats->rx_unicast, stats->rx_cnt)
			    : 0;

Brian



[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