From patchwork Tue Dec 29 10:43:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 7929551 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6AB5E9F318 for ; Tue, 29 Dec 2015 10:44:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CBEC2024D for ; Tue, 29 Dec 2015 10:44:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75700201F2 for ; Tue, 29 Dec 2015 10:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751646AbbL2KoJ (ORCPT ); Tue, 29 Dec 2015 05:44:09 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36581 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbbL2KoI (ORCPT ); Tue, 29 Dec 2015 05:44:08 -0500 Received: by mail-wm0-f68.google.com with SMTP id l65so31626161wmf.3 for ; Tue, 29 Dec 2015 02:43:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=BRRC1bojzSQ/IJFhm6igCDPzzc8zAKMEyAFV+2UyUPg=; b=EP7v3CvgzxqGZhwvo6xpi9UMsPbGsd8MYCDXxBqsJPtfdv2dfpr04KtC9riXVI8tq5 yQjSr+uzA3Me+HdJbLGgkKZoEN3RgFRYDKyi5uSz5Na+8sW6vRcZuAF1yDnZoSi/nqVW TGuj8O4UgrOunclEA2vsxRWagtuj5y4Y2DXfARLxFVutZQjrfXQYxu3adoYTnu8GtZE8 LNfv7WmHnLVcQ28XImNX+VwXE4sGoqU+P/O+3j6qdnVTTw0gvIBDWAgqEi2GKyYv9Xyj Bc6699OXt3+JmZFrfIdgzJvMMl+79PfJoD0Y+kBr1GWNFI4kXqmSoeRH/gOnkeUF5eem sukQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-type:content-transfer-encoding; bh=BRRC1bojzSQ/IJFhm6igCDPzzc8zAKMEyAFV+2UyUPg=; b=PPdDX/pTywczpvCKu4KR10gHxYYrJeya8jYCxk1Aoq91ITkuQU7pyi7R0jR2yO3cRG Xpsm/pV3Ych6UZUqm7BDisN/fJHVrOP6z9aAKqHVt2Zfnc1V2ap6g+AumPA35Rl5RuG6 /PPm55/s05Gk0enIP9/LbmRiKcBlpKzeo59DVzVZxffEj9euvUoQtCRpCvXJp1WvznPg QdBhfn1/IiebCzvHCzJL0z8I8YGHQVjhF0UGNd4FHzpf5dqwdGt5sT+tt7MziAq8h4qF UqdN7xm5c0Ti9P4aZ80dikZw0DcjJeeTPaGD5kk5sF/KcufMaA8yU//UVFD0OHzZzOmC e7RQ== X-Gm-Message-State: ALoCoQnGsUKEHab8dEQUxVsB6Qxfx/31fZD4LxFomJD6ewt1xXujjzXrcLxr/htJR83wdPpROqEzFReHdukhHZRq+DNDBD9+cg== X-Received: by 10.194.103.131 with SMTP id fw3mr38882219wjb.55.1451385827432; Tue, 29 Dec 2015 02:43:47 -0800 (PST) Received: from [192.168.1.134] (c-50-177-107-17.hsd1.ma.comcast.net. [50.177.107.17]) by smtp.googlemail.com with ESMTPSA id 198sm20741388wml.22.2015.12.29.02.43.45 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 29 Dec 2015 02:43:46 -0800 (PST) To: Doug Ledford Cc: Christoph Lameter , "Weiny, Ira" , Matan Barak , "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH v2] IB/core: sysfs.c: Fix PerfMgt ClassPortInfo handling Message-ID: <568263DF.6020505@dev.mellanox.co.il> Date: Tue, 29 Dec 2015 05:43:43 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 Port number is not part of ClassPortInfo attribute but is still needed as a parameter when invoking process_mad. To properly handle this attribute, port_num is added as a parameter to get_counter_table and get_perf_mad was changed not to store port_num in the attribute itself when it's querying the ClassPortInfo attribute. This handles issue pointed out by Matan Barak Fixes: 145d9c541032 ('IB/core: Display extended counter set if available') Signed-off-by: Hal Rosenstock Acked-by: Matan Barak Acked-by: Ira Weiny Reviewed-by: Christoph Lameter --- Change from v1: Added fixes line to description -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 539040f..2daf832 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -438,7 +438,8 @@ static int get_perf_mad(struct ib_device *dev, int port_num, int attr, in_mad->mad_hdr.method = IB_MGMT_METHOD_GET; in_mad->mad_hdr.attr_id = attr; - in_mad->data[41] = port_num; /* PortSelect field */ + if (attr != IB_PMA_CLASS_PORT_INFO) + in_mad->data[41] = port_num; /* PortSelect field */ if ((dev->process_mad(dev, IB_MAD_IGNORE_MKEY, port_num, NULL, NULL, @@ -714,11 +715,12 @@ err: * Figure out which counter table to use depending on * the device capabilities. */ -static struct attribute_group *get_counter_table(struct ib_device *dev) +static struct attribute_group *get_counter_table(struct ib_device *dev, + int port_num) { struct ib_class_port_info cpi; - if (get_perf_mad(dev, 0, IB_PMA_CLASS_PORT_INFO, + if (get_perf_mad(dev, port_num, IB_PMA_CLASS_PORT_INFO, &cpi, 40, sizeof(cpi)) >= 0) { if (cpi.capability_mask && IB_PMA_CLASS_CAP_EXT_WIDTH) @@ -776,7 +778,7 @@ static int add_port(struct ib_device *device, int port_num, goto err_put; } - p->pma_table = get_counter_table(device); + p->pma_table = get_counter_table(device, port_num); ret = sysfs_create_group(&p->kobj, p->pma_table); if (ret) goto err_put_gid_attrs;