From patchwork Fri Nov 6 03:10:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Petrilin X-Patchwork-Id: 57964 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA60Ccbv027749 for ; Fri, 6 Nov 2009 00:12:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759207AbZKFAM1 (ORCPT ); Thu, 5 Nov 2009 19:12:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759212AbZKFAM1 (ORCPT ); Thu, 5 Nov 2009 19:12:27 -0500 Received: from mail.mellanox.co.il ([194.90.237.43]:43234 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759211AbZKFAM0 (ORCPT ); Thu, 5 Nov 2009 19:12:26 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yevgenyp@mellanox.co.il) with SMTP; 6 Nov 2009 02:18:18 +0200 Received: from [10.4.12.75] ([10.4.12.75]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 6 Nov 2009 02:12:30 +0200 Message-ID: <4AF3938A.3080803@mellanox.co.il> Date: Fri, 06 Nov 2009 05:10:02 +0200 From: Yevgeny Petrilin User-Agent: Thunderbird 2.0.0.23 (X11/20090812) MIME-Version: 1.0 To: rdreier@cisco.com CC: linux-rdma@vger.kernel.org, netdev@vger.kernel.org, liranl@mellanox.co.il, tziporet@mellanox.co.il, yevgenyp@mellanox.co.il Subject: [PATCH 19/25 v2] mlx4: Randomizing mac addresses for slaves X-OriginalArrivalTime: 06 Nov 2009 00:12:30.0392 (UTC) FILETIME=[D490BB80:01CA5E75] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index 60889d3..7343c70 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c @@ -32,6 +32,7 @@ * SOFTWARE. */ +#include #include #include @@ -148,7 +149,8 @@ int mlx4_QUERY_SLAVE_CAP_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vh struct mlx4_cmd_mailbox *outbox) { struct mlx4_caps *caps = outbox->buf; - int i; + u8 rand_mac[6]; + int i, j; memcpy(caps, &dev->caps, sizeof *caps); @@ -165,6 +167,10 @@ int mlx4_QUERY_SLAVE_CAP_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vh for (i = 1; i <= dev->caps.num_ports; ++i) { caps->gid_table_len[i] = 1; caps->pkey_table_len[i] = 1; + random_ether_addr(rand_mac); + caps->def_mac[i] = 0; + for (j = 0; j < ETH_ALEN; j++) + caps->def_mac[i] |= ((u64)(rand_mac[1]) << 8 * j); } } else { caps->sqp_demux = dev->num_slaves;