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

From
David Miller <davem@davemloft.net>
Date
2017-02-02 22:34:54
Reply to
Jiri Pirko, 2017-02-02
From: Jiri Pirko <jiri@resnulli.us>
Date: Thu,  2 Feb 2017 16:12:57 +0100
quoted hunk ↗ jump to hunk
+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);
 ...
quoted hunk ↗ jump to hunk
+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);
 ...
quoted hunk ↗ jump to hunk
+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.
Thread (33 messages) 33 messages, 6 authors, last reply 2017-02-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help