From patchwork Tue Jul 10 15:24:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Klein X-Patchwork-Id: 1177901 X-Patchwork-Delegate: ira.weiny@intel.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CC366402D2 for ; Tue, 10 Jul 2012 15:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755866Ab2GJPYj (ORCPT ); Tue, 10 Jul 2012 11:24:39 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:46414 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755857Ab2GJPYi (ORCPT ); Tue, 10 Jul 2012 11:24:38 -0400 Received: by bkwj10 with SMTP id j10so113666bkw.19 for ; Tue, 10 Jul 2012 08:24:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=W0H7y8l/EN/LZFEyHtsAMM0cUQM32UfbwdDY3T6gcsU=; b=TdhABxLC+lSOml1OkHNEwRHqv1oww1MT3Ff3RDbUpvkA81Fu3En3CUnTUSDBUmko5F PYuiYZnUvqUtMzbA3Eq0i0JPzLG/AQQZ0y1vgNUs2CYJVWoIBVxzrFjp5Ms+nueVy9xV 8r8ZjxmfEfLo6Gq+242Grm8FRm2SeEYT/VtCCbmIQUkfA/d6pq7fdxuvYtTA6EvIRqUx ikuIJIO6u9NMBmYtLajfbHFiAkP7wMMIUqfhr1t5zKtAhrPjQyT9jcPBPRm456n392AV e4/w3wUqEI8lg59d+ExIEK9PuY114dJlj7PyljA72d3qAz1bpyoq4HgttMj3y+XZ1cNE ifqA== Received: by 10.205.134.133 with SMTP id ic5mr13788982bkc.15.1341933877150; Tue, 10 Jul 2012 08:24:37 -0700 (PDT) Received: from [172.25.5.23] ([193.47.165.251]) by mx.google.com with ESMTPS id 25sm8258316bkx.9.2012.07.10.08.24.35 (version=SSLv3 cipher=OTHER); Tue, 10 Jul 2012 08:24:36 -0700 (PDT) Message-ID: <4FFC4931.5080508@dev.mellanox.co.il> Date: Tue, 10 Jul 2012 18:24:33 +0300 From: Daniel Klein User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: "linux-rdma@vger.kernel.org" , danielk@mellanox.com Subject: Subject: [PATCHv2] infiniband-diags/vendstat: updated devices supporting extended fw info X-Gm-Message-State: ALoCoQm3WH6SQcsMT/12zIJvF5WYQlIvTMuyl19x+waHYHlMl0QGAmzJ/8+4Kv25jwOEsmRMqcSS Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Changed devices ID to an array of device ID ranges. Version 2: Added range for ConnectX devices: 0x1003 - 0x1011 Signed-off-by: Daniel Klein --- src/vendstat.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/vendstat.c b/src/vendstat.c index 413d202..6183a67 100644 --- a/src/vendstat.c +++ b/src/vendstat.c @@ -58,8 +58,6 @@ /* Config space addresses */ #define IB_MLX_IS3_PORT_XMIT_WAIT 0x10013C -#define IS4_DEV_ID 0x01b3 -#define SX_DEV_ID 0x0245 struct ibmad_port *srcport; @@ -143,6 +141,22 @@ typedef struct { is4_group_select_t group_selects[COUNTER_GROUPS_NUM]; } is4_config_counter_groups_t; +static uint16_t ext_fw_info_device[][2] = { + {0x0245, 0x0245}, + {0xc738, 0xc738}, + {0x01b3, 0x01b3}, + {0x1003, 0x1011}, + {0x0000, 0x0000}}; + +static int is_ext_fw_info_supported(uint16_t device_id) { + int i; + for (i = 0; ext_fw_info_device[i][0]; i++) + if (ext_fw_info_device[i][0] <= device_id && + device_id <= ext_fw_info_device[i][1]) + return 1; + return 0; +} + static int do_vendor(ib_portid_t *portid, struct ibmad_port *srcport, uint8_t class, uint8_t method, uint16_t attr_id, uint32_t attr_mod, void *data) @@ -398,8 +412,7 @@ int main(int argc, char **argv) IB_MLX_IS3_GENERAL_INFO, 0, gi_is3)) IBERROR("generalinfo query"); - if (IS4_DEV_ID == ntohs(gi_is3->hw_info.device_id) || - SX_DEV_ID == ntohs(gi_is3->hw_info.device_id)) { + if (is_ext_fw_info_supported(ntohs(gi_is3->hw_info.device_id))) { gi_is4 = (is4_general_info_t *) &buf; fw_ver_major = ntohl(gi_is4->ext_fw_info.ext_major); fw_ver_minor = ntohl(gi_is4->ext_fw_info.ext_minor);