From 20e72a44098641f0c4de34a31287a93e006afb5b Mon Sep 17 00:00:00 2001 From: Yevgeny Petrilin Date: Thu, 4 Aug 2011 01:05:12 +0000 Subject: [PATCH] mlx4: decreasing ref count when removing mac 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 Tested-by: Roland Dreier Signed-off-by: David S. Miller --- drivers/net/mlx4/port.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c index 1f95afda6841..609e0ec14cee 100644 --- a/drivers/net/mlx4/port.c +++ b/drivers/net/mlx4/port.c @@ -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); } -- 2.20.1