From patchwork Thu Aug 4 11:05:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Petrilin X-Patchwork-Id: 1034642 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p74B5Jqr023836 for ; Thu, 4 Aug 2011 11:05:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753361Ab1HDLFT (ORCPT ); Thu, 4 Aug 2011 07:05:19 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:41206 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753273Ab1HDLFR (ORCPT ); Thu, 4 Aug 2011 07:05:17 -0400 Received: from Internal Mail-Server by MTLPINE2 (envelope-from yevgenyp@mellanox.co.il) with SMTP; 4 Aug 2011 14:05:13 +0300 Received: from [10.4.45.1] (10.4.45.1) by MTLCAS01.mtl.com (10.0.8.70) with Microsoft SMTP Server id 14.1.289.1; Thu, 4 Aug 2011 14:05:12 +0300 Message-ID: <4E3A7CE8.4080407@mellanox.co.il> Date: Thu, 4 Aug 2011 14:05:12 +0300 From: Yevgeny Petrilin User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: CC: , , , Subject: [PATCH] mlx4: decreasing ref count when removing mac X-Originating-IP: [10.4.45.1] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 04 Aug 2011 11:05:23 +0000 (UTC) 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 --- drivers/net/mlx4/port.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c index 1f95afd..609e0ec 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); }