From patchwork Tue Mar 19 08:00:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yanjun X-Patchwork-Id: 10858913 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 2B4F61669 for ; Tue, 19 Mar 2019 07:54:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14140294D6 for ; Tue, 19 Mar 2019 07:54:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0308E295BA; Tue, 19 Mar 2019 07:54:40 +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 83B3E294D6 for ; Tue, 19 Mar 2019 07:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727249AbfCSHyj (ORCPT ); Tue, 19 Mar 2019 03:54:39 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:41584 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfCSHyi (ORCPT ); Tue, 19 Mar 2019 03:54:38 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2J7rv4X074346; Tue, 19 Mar 2019 07:54:33 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=E0UFw4+0pTKfEXk+mCxpuzzXLvoz8sKMrIXyyJNNAS4=; b=u5f+eyuHj37YThV0llk+17buoOOCpKfRvalVPa+LbpXCYf5NIEuYS/zYEniTr1jvq3I6 V/f1l+xM1zrOs8GSTNtZ1gx9EXmradJJ3tW7/LZLmSXM+WfwO9vwxTA3oKwSCCNpUy5C PL1QEeWH7O8lBwgwgl/PxrzEgi+qPLETO3id4E61OazDlu2QLzOrkWb02p6OAyPjFn96 59O4TKM4mm5otV5kL00Yq+g5VAsn899DkneM/qK9On8ioBd3luwqzPHeg70BmlZmE+dO rZKUUjEvDua2ffwaUslUgtORCWUCijAD6Qa27pPrl6BjF0NHRHSd9UJxsZaoF5E48K2B UA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2r8rjujx3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Mar 2019 07:54:33 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2J7sWPm016115 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Mar 2019 07:54:32 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2J7sWFA022633; Tue, 19 Mar 2019 07:54:32 GMT Received: from shipboat.cn.oracle.com (/10.182.69.89) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Mar 2019 00:54:31 -0700 From: Zhu Yanjun To: yishaih@mellanox.com, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org Subject: [PATCH 1/1] IB: mlx4: move the variable into the function Date: Tue, 19 Mar 2019 04:00:23 -0400 Message-Id: <20190319080023.8609-1-yanjun.zhu@oracle.com> X-Mailer: git-send-email 2.17.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9199 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=880 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903190060 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 The variable cur_qp is used in the function mlx4_ib_poll_one. Outside of this function, this variable is not used. So this variable is moved into this function. Signed-off-by: Zhu Yanjun --- drivers/infiniband/hw/mlx4/cq.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 43512347b4f0..6cedca504873 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c @@ -669,7 +669,6 @@ static void mlx4_ib_poll_sw_comp(struct mlx4_ib_cq *cq, int num_entries, } static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, - struct mlx4_ib_qp **cur_qp, struct ib_wc *wc) { struct mlx4_cqe *cqe; @@ -683,6 +682,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, u32 g_mlpath_rqpn; u16 wqe_ctr; unsigned tail = 0; + struct mlx4_ib_qp *cur_qp = NULL; repoll: cqe = next_cqe_sw(cq); @@ -720,8 +720,9 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, goto repoll; } - if (!*cur_qp || - (be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_QPN_MASK) != (*cur_qp)->mqp.qpn) { + if (!cur_qp || + (be32_to_cpu(cqe->vlan_my_qpn) & + MLX4_CQE_QPN_MASK) != cur_qp->mqp.qpn) { /* * We do not have to take the QP table lock here, * because CQs will be locked while QPs are removed @@ -729,10 +729,10 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, */ mqp = __mlx4_qp_lookup(to_mdev(cq->ibcq.device)->dev, be32_to_cpu(cqe->vlan_my_qpn)); - *cur_qp = to_mibqp(mqp); + cur_qp = to_mibqp(mqp); } - wc->qp = &(*cur_qp)->ibqp; + wc->qp = &cur_qp->ibqp; if (wc->qp->qp_type == IB_QPT_XRC_TGT) { u32 srq_num; @@ -744,15 +744,15 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, } if (is_send) { - wq = &(*cur_qp)->sq; - if (!(*cur_qp)->sq_signal_bits) { + wq = &cur_qp->sq; + if (!cur_qp->sq_signal_bits) { wqe_ctr = be16_to_cpu(cqe->wqe_index); wq->tail += (u16) (wqe_ctr - (u16) wq->tail); } wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)]; ++wq->tail; - } else if ((*cur_qp)->ibqp.srq) { - srq = to_msrq((*cur_qp)->ibqp.srq); + } else if (cur_qp->ibqp.srq) { + srq = to_msrq(cur_qp->ibqp.srq); wqe_ctr = be16_to_cpu(cqe->wqe_index); wc->wr_id = srq->wrid[wqe_ctr]; mlx4_ib_free_srq_wqe(srq, wqe_ctr); @@ -762,7 +762,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, wc->wr_id = srq->wrid[wqe_ctr]; mlx4_ib_free_srq_wqe(srq, wqe_ctr); } else { - wq = &(*cur_qp)->rq; + wq = &cur_qp->rq; tail = wq->tail & (wq->wqe_cnt - 1); wc->wr_id = wq->wrid[tail]; ++wq->tail; @@ -847,13 +847,13 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, } is_eth = (rdma_port_get_link_layer(wc->qp->device, - (*cur_qp)->port) == + cur_qp->port) == IB_LINK_LAYER_ETHERNET); if (mlx4_is_mfunc(to_mdev(cq->ibcq.device)->dev)) { - if ((*cur_qp)->mlx4_ib_qp_type & + if (cur_qp->mlx4_ib_qp_type & (MLX4_IB_QPT_PROXY_SMI_OWNER | MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI)) { - use_tunnel_data(*cur_qp, cq, wc, tail, cqe, + use_tunnel_data(cur_qp, cq, wc, tail, cqe, is_eth); return 0; } @@ -891,7 +891,6 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) { struct mlx4_ib_cq *cq = to_mcq(ibcq); - struct mlx4_ib_qp *cur_qp = NULL; unsigned long flags; int npolled; struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); @@ -903,7 +902,7 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) } for (npolled = 0; npolled < num_entries; ++npolled) { - if (mlx4_ib_poll_one(cq, &cur_qp, wc + npolled)) + if (mlx4_ib_poll_one(cq, wc + npolled)) break; }