Skip to content

Commit ce470b4

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum: Drop struct span_entry.used
The member ref_count already determines whether a given SPAN entry is used, and is as easy to use as a dedicated boolean. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 306a934 commit ce470b4

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ mlxsw_sp_span_entry_create(struct mlxsw_sp_port *port)
534534
/* find a free entry to use */
535535
index = -1;
536536
for (i = 0; i < mlxsw_sp->span.entries_count; i++) {
537-
if (!mlxsw_sp->span.entries[i].used) {
537+
if (!mlxsw_sp->span.entries[i].ref_count) {
538538
index = i;
539539
span_entry = &mlxsw_sp->span.entries[i];
540540
break;
@@ -549,7 +549,6 @@ mlxsw_sp_span_entry_create(struct mlxsw_sp_port *port)
549549
if (err)
550550
return NULL;
551551

552-
span_entry->used = true;
553552
span_entry->id = index;
554553
span_entry->ref_count = 1;
555554
span_entry->local_port = local_port;
@@ -565,7 +564,6 @@ static void mlxsw_sp_span_entry_destroy(struct mlxsw_sp *mlxsw_sp,
565564

566565
mlxsw_reg_mpat_pack(mpat_pl, pa_id, local_port, false);
567566
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl);
568-
span_entry->used = false;
569567
}
570568

571569
struct mlxsw_sp_span_entry *
@@ -576,7 +574,7 @@ mlxsw_sp_span_entry_find(struct mlxsw_sp *mlxsw_sp, u8 local_port)
576574
for (i = 0; i < mlxsw_sp->span.entries_count; i++) {
577575
struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i];
578576

579-
if (curr->used && curr->local_port == local_port)
577+
if (curr->ref_count && curr->local_port == local_port)
580578
return curr;
581579
}
582580
return NULL;

drivers/net/ethernet/mellanox/mlxsw/spectrum.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ struct mlxsw_sp_span_inspected_port {
124124

125125
struct mlxsw_sp_span_entry {
126126
u8 local_port;
127-
bool used;
128127
struct list_head bound_ports_list;
129128
int ref_count;
130129
int id;

0 commit comments

Comments
 (0)