From patchwork Wed Jun 19 00:51:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Chu X-Patchwork-Id: 2746211 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BED169F3A0 for ; Wed, 19 Jun 2013 00:51:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E298220212 for ; Wed, 19 Jun 2013 00:51:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17EA4201F7 for ; Wed, 19 Jun 2013 00:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933066Ab3FSAvK (ORCPT ); Tue, 18 Jun 2013 20:51:10 -0400 Received: from prdiron-3.llnl.gov ([128.15.143.173]:39027 "EHLO prdiron-3.llnl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933445Ab3FSAvK (ORCPT ); Tue, 18 Jun 2013 20:51:10 -0400 X-Attachments: Received: from auk59.llnl.gov (HELO [134.9.93.24]) ([134.9.93.24]) by prdiron-3.llnl.gov with ESMTP; 18 Jun 2013 17:51:09 -0700 Subject: [PATCH] ibsim: Do not return allportselect for non-switches From: Albert Chu To: linux-rdma@vger.kernel.org Date: Tue, 18 Jun 2013 17:51:08 -0700 Message-Id: <1371603068.19017.95.camel@auk59.llnl.gov> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-19.el5) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ibsim only supports allportselect (i.e. port 0xff) for switches but not HCAs. However the allportselect flag would be returned for all classportinfo requests, leading to unexpected results when running some infiniband-diag tools against ibsim. Signed-off-by: Albert L. Chu --- ibsim/sim_mad.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c index 0b52c52..223d507 100644 --- a/ibsim/sim_mad.c +++ b/ibsim/sim_mad.c @@ -235,6 +235,7 @@ static int reply_MAD(void *buf, ib_rpc_t * rpc, ib_dr_path_t * path, static int do_cpi(Port * port, unsigned op, uint32_t mod, uint8_t * data) { + Node *node = port->node; int status = 0; if (op != IB_MAD_METHOD_GET) @@ -242,7 +243,10 @@ static int do_cpi(Port * port, unsigned op, uint32_t mod, uint8_t * data) memset(data, 0, IB_SMP_DATA_SIZE); mad_set_field(data, 0, IB_CPI_BASEVER_F, 1); mad_set_field(data, 0, IB_CPI_CLASSVER_F, 1); - mad_set_field(data, 0, IB_CPI_CAPMASK_F, 0x300); + if (node->type != SWITCH_NODE) + mad_set_field(data, 0, IB_CPI_CAPMASK_F, 0x200); + else + mad_set_field(data, 0, IB_CPI_CAPMASK_F, 0x300); mad_set_field(data, 0, IB_CPI_RESP_TIME_VALUE_F, 0x12); return status; }