[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 02 Feb 2017 17:34:48 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: jiri@...nulli.us
Cc: netdev@...r.kernel.org, idosch@...lanox.com, eladr@...lanox.com,
mlxsw@...lanox.com, ogerlitz@...lanox.com, jhs@...atatu.com,
ivecera@...hat.com, jbenc@...hat.com
Subject: Re: [patch net-next 17/19] mlxsw: spectrum: Introduce ACL core
with simple TCAM implementation
From: Jiri Pirko <jiri@...nulli.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.
Powered by blists - more mailing lists