From patchwork Fri Dec 10 20:38:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bounine, Alexandre" X-Patchwork-Id: 75138 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 6B807B7682 for ; Sat, 11 Dec 2010 07:41:09 +1100 (EST) Received: from mxout1.idt.com (mxout1.idt.com [157.165.5.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mxout1.idt.com", Issuer "idt.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 28E79B70AA for ; Sat, 11 Dec 2010 07:38:49 +1100 (EST) Received: from mail.idt.com (localhost [127.0.0.1]) by mxout1.idt.com (8.13.1/8.13.1) with ESMTP id oBAKccgZ019251; Fri, 10 Dec 2010 12:38:38 -0800 Received: from corpml1.corp.idt.com (corpml1.corp.idt.com [157.165.140.20]) by mail.idt.com (8.13.8/8.13.8) with ESMTP id oBAKcbDa024483; Fri, 10 Dec 2010 12:38:37 -0800 (PST) Received: from corpvpnfw (localhost [127.0.0.1]) by corpml1.corp.idt.com (8.11.7p1+Sun/8.11.7) with SMTP id oBAKcau25486; Fri, 10 Dec 2010 12:38:36 -0800 (PST) Received: from amak.ott.idt.com ([10.1.0.134]) by corpvpnfw; Fri, 10 Dec 2010 20:38:28 +0000 (GMT) Received: from amak.tundra.com (localhost.localdomain [127.0.0.1]) by amak.tundra.com (8.13.1/8.13.1) with ESMTP id oBAKcQPF031529; Fri, 10 Dec 2010 15:38:26 -0500 Received: (from abounine@localhost) by amak.tundra.com (8.13.1/8.13.1/Submit) id oBAKcQZG031525; Fri, 10 Dec 2010 15:38:26 -0500 From: Alexandre Bounine To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH -mm 3/4] RapidIO: Use Component Tag for unified switch identification Date: Fri, 10 Dec 2010 15:38:17 -0500 Message-Id: <1292013498-31406-4-git-send-email-alexandre.bounine@idt.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1292013498-31406-1-git-send-email-alexandre.bounine@idt.com> References: <1292013498-31406-1-git-send-email-alexandre.bounine@idt.com> X-Scanned-By: MIMEDefang 2.43 Cc: Alexandre Bounine , Thomas Moll X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Change the way how switchid value is set. Local counter variable does not provide unified way to identify switch devices in a system with multiple processors. Using local counter leads to the situation when the same RIO switch has different switch ID for each processor. Replacing local counter with unique portion of the Component Tag provides unified reference to the switch by every processor in the system. Signed-off-by: Alexandre Bounine Cc: Kumar Gala Cc: Matt Porter Cc: Li Yang Cc: Thomas Moll Cc: Micha Nelissen --- drivers/rapidio/rio-scan.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index e655756..467e82b 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -46,7 +46,6 @@ static void rio_init_em(struct rio_dev *rdev); DEFINE_SPINLOCK(rio_global_list_lock); static int next_destid = 0; -static int next_switchid = 0; static int next_net = 0; static int next_comptag = 1; @@ -438,6 +437,10 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net, rio_mport_write_config_32(port, destid, hopcount, RIO_COMPONENT_TAG_CSR, next_comptag); rdev->comp_tag = next_comptag++; + } else { + rio_mport_read_config_32(port, destid, hopcount, + RIO_COMPONENT_TAG_CSR, + &rdev->comp_tag); } if (rio_device_has_destid(port, rdev->src_ops, rdev->dst_ops)) { @@ -461,7 +464,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net, /* If a PE has both switch and other functions, show it as a switch */ if (rio_is_switch(rdev)) { rswitch = rdev->rswitch; - rswitch->switchid = next_switchid; + rswitch->switchid = rdev->comp_tag & RIO_CTAG_UDEVID; rswitch->port_ok = 0; rswitch->route_table = kzalloc(sizeof(u8)* RIO_MAX_ROUTE_ENTRIES(port->sys_size), @@ -816,7 +819,6 @@ static int __devinit rio_enum_peer(struct rio_net *net, struct rio_mport *port, return -1; if (rio_is_switch(rdev)) { - next_switchid++; sw_inport = RIO_GET_PORT_NUM(rdev->swpinfo); rio_route_add_entry(rdev, RIO_GLOBAL_TABLE, port->host_deviceid, sw_inport, 0); @@ -964,8 +966,6 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid, return -1; if (rio_is_switch(rdev)) { - next_switchid++; - /* Associated destid is how we accessed this switch */ rdev->destid = destid;