# Re: \[patch net-next 17/19\] mlxsw: spectrum: Introduce ACL core with simple TCAM implementation

- From: Jiri Pirko \<jiri@resnulli.us\>
- Date: 2017-02-03 06:53:47 
- List: netdev
- Page: https://ratatoskr.run/netdev/2017/02/11043466
- Thread: https://ratatoskr.run/netdev/2017/02/11043291/t.md

```text
Thu, Feb 02, 2017 at 11:34:48PM CET, davem@davemloft.net wrote:
>From: Jiri Pirko <jiri@resnulli.us>
>Date: Thu,  2 Feb 2017 16:12:57 +0100
>
>> +static int mlxsw_sp_acl_tcam_region_id_get(struct mlxsw_sp_acl_tcam *tcam,
>> +					   u16 *p_id)
>> +{
>> +	u16 id;
>> +
>> +	id = find_first_zero_bit(tcam->used_regions, tcam->max_regions);
>> +	if (id < tcam->max_regions) {
>> +		set_bit(id, tcam->used_regions);
> ...
>> +static void mlxsw_sp_acl_tcam_region_id_put(struct mlxsw_sp_acl_tcam *tcam,
>> +					    u16 id)
>> +{
>> +	clear_bit(id, tcam->used_regions);
>> +}
>> +
>> +static int mlxsw_sp_acl_tcam_group_id_get(struct mlxsw_sp_acl_tcam *tcam,
>> +					  u16 *p_id)
>> +{
>> +	u16 id;
>> +
>> +	id = find_first_zero_bit(tcam->used_groups, tcam->max_groups);
>> +	if (id < tcam->max_groups) {
>> +		set_bit(id, tcam->used_groups);
> ...
>> +static void mlxsw_sp_acl_tcam_group_id_put(struct mlxsw_sp_acl_tcam *tcam,
>> +					   u16 id)
>> +{
>> +	clear_bit(id, tcam->used_groups);
>> +}
>
>Please use __set_bit() and __clear_bit() here since it seems very clear that
>you do not require atomic operations.

Will do.
```
