From patchwork Mon Dec 28 21:53:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 7927581 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 884BEBEEE5 for ; Mon, 28 Dec 2015 21:53:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB835201EC for ; Mon, 28 Dec 2015 21:53:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82B98201DD for ; Mon, 28 Dec 2015 21:53:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752825AbbL1VxY (ORCPT ); Mon, 28 Dec 2015 16:53:24 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:33504 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752812AbbL1VxX (ORCPT ); Mon, 28 Dec 2015 16:53:23 -0500 Received: by mail-wm0-f46.google.com with SMTP id f206so20711699wmf.0 for ; Mon, 28 Dec 2015 13:53:22 -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=4/ad6fgIAtchjtyKbrK+ZQZLaiBYJX+6chvzf0zhv8Q=; b=pYJBz2GZnMlj66wtbRvtIG7bzHq4UTHLfOrGb5QTw7jEV147GlpzaBJhBHei0dCa9Q T+Xqn7sc8mVXbqRCW3Wasf5Q7siRCoIt9F+TVVZ32dY6EKWtLH4jN0pSTgH/gnBfSdtX aesoZTsyUKjx9b4MwEY3DG54U9CRxAlzbDGWUx6ZA+UHP88SFzxTV4KzeuBIdKrqzHfR ofh4TRvT9nrky8LBwXaig0SIxmYkHokN9iftJ0LWUKn/0BInxnWTWRcrAyn/PPe44Q6/ uVcqBsmhYVhAOMXwy+JAf8fA10LcgrjTy+Hq6RIvuGajfIx9DzPlTqDo6nFx1pl7AF6D 4klQ== 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=4/ad6fgIAtchjtyKbrK+ZQZLaiBYJX+6chvzf0zhv8Q=; b=O+GkBD5fmkQsNujqmC1sI+jRJDdbWEiSc/YkVFtf2mivqDI/viKAldy8cw2WLot3Np kP9Qx/dgvoeLlc2xYNGooJbCYNQx1PLhwG5CLHcpRjOG8R8sP2B68qcp3AvUqD9hm/Xz z8CURQCsDUTuQtmpzj51/r0m5NNSG2pF1Z3bmRyeA/eFB67RzGKrh0Znm7Ld11qVSPJW hH4POwy+zL306imjmhDVQ/TbeGlbaob6s6oecu/J9/sKpRs4AxkpX0WQu2lsUDabfbIC AAP6ap9oxJJlBNMRTxYvLCd1DMW1YZrueCWBo2/zsuiNojfVA+9z6xqHp488gVZvB2a7 /xPA== X-Gm-Message-State: ALoCoQnzbPL8uZg0GZei/wEc16ExBpwblZam0LixGknOfowuwb2ns2Q2wsFXY12u9IsRCfiPDn4474oHdV3gUQLJfuhMyDlZDQ== X-Received: by 10.28.158.74 with SMTP id h71mr24817989wme.74.1451339601436; Mon, 28 Dec 2015 13:53:21 -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 z65sm10021658wmg.10.2015.12.28.13.53.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Dec 2015 13:53:20 -0800 (PST) To: Doug Ledford Cc: Christoph Lameter , "Weiny, Ira" , "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH] IB/core: sysfs.c: Fix PerfMgt ClassPortInfo handling Message-ID: <5681AF4E.8060604@dev.mellanox.co.il> Date: Mon, 28 Dec 2015 16:53:18 -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 Signed-off-by: Hal Rosenstock Acked-by: Matan Barak Reviewed-by: Ira Weiny --- -- 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;