/* find a free entry to use */
index = -1;
for (i = 0; i < mlxsw_sp->span.entries_count; i++) {
- if (!mlxsw_sp->span.entries[i].used) {
+ if (!mlxsw_sp->span.entries[i].ref_count) {
index = i;
span_entry = &mlxsw_sp->span.entries[i];
break;
if (err)
return NULL;
- span_entry->used = true;
span_entry->id = index;
span_entry->ref_count = 1;
span_entry->local_port = local_port;
mlxsw_reg_mpat_pack(mpat_pl, pa_id, local_port, false);
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mpat), mpat_pl);
- span_entry->used = false;
}
struct mlxsw_sp_span_entry *
for (i = 0; i < mlxsw_sp->span.entries_count; i++) {
struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i];
- if (curr->used && curr->local_port == local_port)
+ if (curr->ref_count && curr->local_port == local_port)
return curr;
}
return NULL;