Search Linux Wireless

Re: [RFC v3 02/12] rtw88: core files

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

 



On Wed, 2018-10-03 at 19:20 +0800, yhchuang@xxxxxxxxxxx wrote:

If you use bitmaps for the security CAM index tracking,

this:

> +u32 rtw_sec_installed_cam_num(struct rtw_sec_desc *sec)
> +{
> +	u32 cnt = 0;
> +	int i;
> +
> +	for (i = 0; i < sec->total_cam_num; i++)
> +		if (sec->cam_table[i].used)
> +			cnt++;
> +
> +	return cnt;
> +}

becomes hweight(), and this:

> +int rtw_sec_get_free_cam(struct rtw_sec_desc *sec)
> +{
> +	int i;
> +
> +	/* if default key search is enabled, the first 4 cam entries
> +	 * are used to direct map to group key with its key->key_idx, so
> +	 * driver should use cam entries after 4 to install pairwise key
> +	 */
> +	i = sec->default_key_search ? RTW_SEC_DEFAULT_KEY_NUM : 0;
> +	for (; i < sec->total_cam_num; i++)
> +		if (!sec->cam_table[i].used)
> +			return i;
> +
> +	return i;
> +}

just find_next_zero_bit().

Your code hard-codes an assumption that default_key_search is true
though, afaict, so you can probably just remove that.

johannes



[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