From patchwork Sat Dec 15 08:09:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yanjun X-Patchwork-Id: 10732039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BCFFC746 for ; Sat, 15 Dec 2018 08:04:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D83E2A16C for ; Sat, 15 Dec 2018 08:04:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80D852A77D; Sat, 15 Dec 2018 08:04:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E6762A16C for ; Sat, 15 Dec 2018 08:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728731AbeLOIEh (ORCPT ); Sat, 15 Dec 2018 03:04:37 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:34740 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbeLOIEh (ORCPT ); Sat, 15 Dec 2018 03:04:37 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBF84IKw084321; Sat, 15 Dec 2018 08:04:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2018-07-02; bh=R/fDfgODBFFRCICKJz/2s3NfUTDq+h+DTDUF6ikp59M=; b=Da0VzgIIlKxd6jin57kjhyrsxieQ1Sm+Z9Jkbs6RMthPaMX4U29Mqv9ugOFLAPHqJK12 wn6ceuc5Ks/Ja/S+cDyQziq4gMhLT/W0swjlqZztQDDlPajQHLtgHIh0Zom2NxT6JXV6 en8NUE0CaawAz7UJbRmXvNnO8WC5ZqD6vnhJ3wFoDILK3Wt93zGgRNLEOFZevISkw6jv guex49Yg77rY7OCK65kf023hqMQ/Ypj2NlEC6CWZFy770P5CMuoYW6MD/K/FN7kOIj7v I3k1Yu260Z9sKQklb11OCZ+dEX2xOqJGnrOkaZ3AzZQqEGFDUh+/xDQmf8F4GlsnOLvd bQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2pcs1t8abj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 15 Dec 2018 08:04:30 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBF84TYR026865 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 15 Dec 2018 08:04:29 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wBF84SkV021005; Sat, 15 Dec 2018 08:04:29 GMT Received: from shipboat.cn.oracle.com (/10.182.70.235) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 15 Dec 2018 00:04:28 -0800 From: Zhu Yanjun To: monis@mellanox.com, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org Subject: [PATCH 1/1] IB: rxe: replace ARRAYSIZE with RXE_NUM_OF_COUNTERS Date: Sat, 15 Dec 2018 03:09:52 -0500 Message-Id: <20181215080952.15762-1-yanjun.zhu@oracle.com> X-Mailer: git-send-email 2.17.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9107 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=579 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812150072 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP RXE_NUM_OF_COUNTERS is the number of counters. So it can be used directly. Signed-off-by: Zhu Yanjun --- drivers/infiniband/sw/rxe/rxe_hw_counters.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_hw_counters.c b/drivers/infiniband/sw/rxe/rxe_hw_counters.c index 6aeb7a165e46..8df4b1592d6d 100644 --- a/drivers/infiniband/sw/rxe/rxe_hw_counters.c +++ b/drivers/infiniband/sw/rxe/rxe_hw_counters.c @@ -58,21 +58,20 @@ int rxe_ib_get_hw_stats(struct ib_device *ibdev, if (!port || !stats) return -EINVAL; - for (cnt = 0; cnt < ARRAY_SIZE(rxe_counter_name); cnt++) + for (cnt = 0; cnt < RXE_NUM_OF_COUNTERS; cnt++) stats->value[cnt] = dev->stats_counters[cnt]; - return ARRAY_SIZE(rxe_counter_name); + return RXE_NUM_OF_COUNTERS; } struct rdma_hw_stats *rxe_ib_alloc_hw_stats(struct ib_device *ibdev, u8 port_num) { - BUILD_BUG_ON(ARRAY_SIZE(rxe_counter_name) != RXE_NUM_OF_COUNTERS); /* We support only per port stats */ if (!port_num) return NULL; return rdma_alloc_hw_stats_struct(rxe_counter_name, - ARRAY_SIZE(rxe_counter_name), + RXE_NUM_OF_COUNTERS, RDMA_HW_STATS_DEFAULT_LIFESPAN); }