Skip to content

Commit

Permalink
mlx4: decreasing ref count when removing mac
Browse files Browse the repository at this point in the history
For older FW versions, when a Mac address removed from Mac table,
we should set 0 for reference count for the corresponding Mac index.
Fixes a bug where removing Mac from the table still left that entry as
invalid.

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Tested-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yevgeny Petrilin authored and David S. Miller committed Aug 5, 2011
1 parent c70a3a9 commit 20e72a4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/mlx4/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,12 @@ void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn)
if (validate_index(dev, table, index))
goto out;

table->entries[index] = 0;
mlx4_set_port_mac_table(dev, port, table->entries);
--table->total;
/* Check whether this address has reference count */
if (!(--table->refs[index])) {
table->entries[index] = 0;
mlx4_set_port_mac_table(dev, port, table->entries);
--table->total;
}
out:
mutex_unlock(&table->mutex);
}
Expand Down

0 comments on commit 20e72a4

Please sign in to comment.