From patchwork Wed Nov 4 15:31:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Petrilin X-Patchwork-Id: 57553 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 nA4CYxuO022927 for ; Wed, 4 Nov 2009 12:35:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755934AbZKDMeK (ORCPT ); Wed, 4 Nov 2009 07:34:10 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755936AbZKDMeK (ORCPT ); Wed, 4 Nov 2009 07:34:10 -0500 Received: from mail.mellanox.co.il ([194.90.237.43]:34759 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755934AbZKDMeH (ORCPT ); Wed, 4 Nov 2009 07:34:07 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yevgenyp@mellanox.co.il) with SMTP; 4 Nov 2009 14:39:51 +0200 Received: from [10.4.12.75] ([10.4.12.75]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Nov 2009 14:34:11 +0200 Message-ID: <4AF19E69.8070605@mellanox.co.il> Date: Wed, 04 Nov 2009 17:31:53 +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] mlx4: Randomizing mac addresses for slaves X-OriginalArrivalTime: 04 Nov 2009 12:34:11.0565 (UTC) FILETIME=[1C8159D0:01CA5D4B] 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..9028592 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c @@ -32,6 +32,7 @@ * SOFTWARE. */ +#include #include #include @@ -148,6 +149,7 @@ 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; + u8 rand_mac[6]; int i; 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; +#define MLX4_MAC_HEAD 0x2c9000000ULL + random_ether_addr(rand_mac); + caps->def_mac[i] = MLX4_MAC_HEAD | rand_mac[0] | + ((u64)(rand_mac[1]) << 8) | ((u64)(rand_mac[2]) << 16); } } else { caps->sqp_demux = dev->num_slaves;