From patchwork Thu Mar 7 12:48:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2231481 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 21A44DF223 for ; Thu, 7 Mar 2013 12:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757365Ab3CGMsJ (ORCPT ); Thu, 7 Mar 2013 07:48:09 -0500 Received: from mail-ee0-f42.google.com ([74.125.83.42]:41985 "EHLO mail-ee0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757194Ab3CGMsI (ORCPT ); Thu, 7 Mar 2013 07:48:08 -0500 Received: by mail-ee0-f42.google.com with SMTP id b47so256574eek.1 for ; Thu, 07 Mar 2013 04:48:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=YhIMs+h52tnw341KGb0NZbAusYg0c+ihD4bszAepOiQ=; b=TVh1HPaQj2SNRrq5Awmd5rf6DUF683GsiZ0jSzeYpx+DuO5SsbnPm0AfhvKKqyOjN2 /l+xEDggyvlURzXlvDlKu5I9E0BV9jrsFHJXDa3O3+UQYkinXnjQH7MxauqiSTKT/bJE Hq2HFduwAzD91fHVTgStKe+NrpgqkPLE2NE/CB9yAXsr/TvtlOUBDSIDskupzAMODgoV Ws4zHmSQXcbt/XvFImwNSVAbN3ANN1SDF/EJTkg6jk393OdtJWbCmby7V23lVpXyfuct 9R+kbkSf25xkR58NeRn0aAEQoOI97XGc65B/wwJxkWPFIanBieAAFSoT31MnMCowKA5z +vPw== X-Received: by 10.14.214.66 with SMTP id b42mr93277698eep.34.1362660487160; Thu, 07 Mar 2013 04:48:07 -0800 (PST) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPS id t4sm2083590eel.0.2013.03.07.04.48.05 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Mar 2013 04:48:06 -0800 (PST) Message-ID: <51388C83.3050905@dev.mellanox.co.il> Date: Thu, 07 Mar 2013 07:48:03 -0500 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" Subject: [PATCH 3/3] osmtest: Add support for full world path records back as option X-Gm-Message-State: ALoCoQmq3G2TS9Q26eN3sz+wi2KfWhMOTK1iPXnyllryGsN/Hsy/vc9duFp922RPTPqn0DKaDe3I Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Signed-off-by: Hal Rosenstock --- osmtest/include/osmtest.h | 1 + osmtest/main.c | 6 ++++++ osmtest/osmtest.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 0 deletions(-) diff --git a/osmtest/include/osmtest.h b/osmtest/include/osmtest.h index c3134ef..4a7f0a3 100644 --- a/osmtest/include/osmtest.h +++ b/osmtest/include/osmtest.h @@ -86,6 +86,7 @@ typedef struct _osmtest_opt { uint8_t wait_time; char *log_file; boolean_t ignore_path_records; + boolean_t full_world_path_recs; } osmtest_opt_t; /* diff --git a/osmtest/main.c b/osmtest/main.c index 7b586e9..6129674 100644 --- a/osmtest/main.c +++ b/osmtest/main.c @@ -107,6 +107,7 @@ void show_usage() " -d0 - Unused.\n" " -d1 - Do not scan/compare path records.\n" " -d2 - Force log flushing after each log message.\n" + " -d4 - Use full world path record queries.\n" " Without -d, no debug options are enabled\n\n"); printf("-m \n" "--max_lid \n" @@ -327,6 +328,7 @@ int main(int argc, char *argv[]) opt.create = FALSE; opt.mmode = 1; opt.ignore_path_records = FALSE; /* Do path Records too */ + opt.full_world_path_recs = FALSE; opt.flow = OSMT_FLOW_ALL; /* run all validation tests */ strcpy(flow_name, "All Validations"); strcpy(opt.file_name, "osmtest.dat"); @@ -533,6 +535,10 @@ int main(int argc, char *argv[]) printf("Force Log Flush\n"); opt.force_log_flush = TRUE; break; + case 4: + printf("Use Full World Path Record Queries\n"); + opt.full_world_path_recs = TRUE; + break; case 3: /* Used to be memory tracking */ default: diff --git a/osmtest/osmtest.c b/osmtest/osmtest.c index 9dd0b98..75e7c55 100644 --- a/osmtest/osmtest.c +++ b/osmtest/osmtest.c @@ -2238,6 +2238,9 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh) OSM_LOG_ENTER(&p_osmt->log); + if (p_osmt->opt.full_world_path_recs) + goto full_world; + result = fprintf(fh, "#\n" "# Path Records\n" "#\n"); if (result < 0) { OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0026: " @@ -2275,6 +2278,43 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh) } p_dst_node = (node_t *) cl_qmap_next(&p_dst_node->map_item); } + goto Exit; + +full_world: + memset(&context, 0, sizeof(context)); + + /* + * Do a blocking query for all PathRecords in the subnet. + */ + status = osmtest_get_all_recs(p_osmt, IB_MAD_ATTR_PATH_RECORD, + sizeof(*p_rec), &context); + + if (status != IB_SUCCESS) { + OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0002: " + "osmtest_get_all_recs failed (%s)\n", + ib_get_err_str(status)); + goto Exit; + } + /* + * Write the received records out to the file. + */ + num_recs = context.result.result_cnt; + + OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs); + + result = fprintf(fh, "#\n" "# Path Records\n" "#\n"); + if (result < 0) { + OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0005: " + "Write failed\n"); + status = IB_ERROR; + goto Exit; + } + + for (i = 0; i < num_recs; i++) { + p_rec = + osmv_get_query_path_rec(context.result.p_result_madw, i); + osmtest_write_path_info(p_osmt, fh, p_rec); + } Exit: /*