From patchwork Mon Dec 17 18:45:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 1014693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="OFKHcxBp"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JVt51MYFz9s7W for ; Tue, 18 Dec 2018 06:03:24 +1100 (AEDT) Received: from localhost ([::1]:48479 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYyAi-00023A-Rh for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 14:03:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYxvg-00060F-TS for qemu-devel@nongnu.org; Mon, 17 Dec 2018 13:47:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYxvd-0002SB-Is for qemu-devel@nongnu.org; Mon, 17 Dec 2018 13:47:48 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:50258) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYxvd-0002RT-9p for qemu-devel@nongnu.org; Mon, 17 Dec 2018 13:47:45 -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 wBHIiIk3119982; Mon, 17 Dec 2018 18:47:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=739oRk6MR60g/Df7kGEBW7GYhWrODmK4BiKP2eev8U4=; b=OFKHcxBpfWi2ZHufsaKNYv/oJ9agjdmvO3Efl9PqXIJRK6oVty5WttG768QVMZ7gC6Bq jEaCv+LumVMwGtjMOkm4S9dwpp4gdABUVOrgQZ8PRZwqZFzeQ8h6chrKNl6lFTqtB5TG oWg/BHFM1ht3yssKB9Xy+YtVYVag9VyC+ibUTLrWIY/F5qCnXVW9a8DzMaaN7narfOVx 1Q+2psPMf65Xexh9wBsnJWSNzp+B2JWVtMvN6tmuLeuZnvXtBJD/y8ac5HzvN5a4LO4X FL1hVt2EDIM9lPBAXFw9ihHe5ehW7CJ8v03NsM/A8wyWHI0965KvJBT81soQxhZIYIae kg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2pcs1tf9qa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Dec 2018 18:47:43 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wBHIlgrA024426 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Dec 2018 18:47:42 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wBHIlgPC009270; Mon, 17 Dec 2018 18:47:42 GMT Received: from localhost.localdomain (/77.138.186.148) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 17 Dec 2018 10:47:42 -0800 From: Yuval Shaia To: yuval.shaia@oracle.com, marcel.apfelbaum@gmail.com, dmitry.fleytman@gmail.com, jasowang@redhat.com, eblake@redhat.com, armbru@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, shamir.rabinovitch@oracle.com, cohuck@redhat.com Date: Mon, 17 Dec 2018 20:45:35 +0200 Message-Id: <20181217184540.4571-19-yuval.shaia@oracle.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181217184540.4571-1-yuval.shaia@oracle.com> References: <20181217184540.4571-1-yuval.shaia@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9110 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=952 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812170164 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 Subject: [Qemu-devel] [PATCH v8 18/23] hw/rdma: Remove unneeded code that handles more that one port X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Device supports only one port, let's remove a dead code that handles more than one port. Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum --- hw/rdma/rdma_rm.c | 34 ++++++++++++++++------------------ hw/rdma/rdma_rm.h | 2 +- hw/rdma/rdma_rm_defs.h | 4 ++-- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c index 250254561c..b7d4ebe972 100644 --- a/hw/rdma/rdma_rm.c +++ b/hw/rdma/rdma_rm.c @@ -545,7 +545,7 @@ int rdma_rm_add_gid(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev, return -EINVAL; } - memcpy(&dev_res->ports[0].gid_tbl[gid_idx].gid, gid, sizeof(*gid)); + memcpy(&dev_res->port.gid_tbl[gid_idx].gid, gid, sizeof(*gid)); return 0; } @@ -556,15 +556,15 @@ int rdma_rm_del_gid(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev, int rc; rc = rdma_backend_del_gid(backend_dev, ifname, - &dev_res->ports[0].gid_tbl[gid_idx].gid); + &dev_res->port.gid_tbl[gid_idx].gid); if (rc) { pr_dbg("Fail to delete gid\n"); return -EINVAL; } - memset(dev_res->ports[0].gid_tbl[gid_idx].gid.raw, 0, - sizeof(dev_res->ports[0].gid_tbl[gid_idx].gid)); - dev_res->ports[0].gid_tbl[gid_idx].backend_gid_index = -1; + memset(dev_res->port.gid_tbl[gid_idx].gid.raw, 0, + sizeof(dev_res->port.gid_tbl[gid_idx].gid)); + dev_res->port.gid_tbl[gid_idx].backend_gid_index = -1; return 0; } @@ -577,16 +577,16 @@ int rdma_rm_get_backend_gid_index(RdmaDeviceResources *dev_res, return -EINVAL; } - if (unlikely(dev_res->ports[0].gid_tbl[sgid_idx].backend_gid_index == -1)) { - dev_res->ports[0].gid_tbl[sgid_idx].backend_gid_index = + if (unlikely(dev_res->port.gid_tbl[sgid_idx].backend_gid_index == -1)) { + dev_res->port.gid_tbl[sgid_idx].backend_gid_index = rdma_backend_get_gid_index(backend_dev, - &dev_res->ports[0].gid_tbl[sgid_idx].gid); + &dev_res->port.gid_tbl[sgid_idx].gid); } pr_dbg("backend_gid_index=%d\n", - dev_res->ports[0].gid_tbl[sgid_idx].backend_gid_index); + dev_res->port.gid_tbl[sgid_idx].backend_gid_index); - return dev_res->ports[0].gid_tbl[sgid_idx].backend_gid_index; + return dev_res->port.gid_tbl[sgid_idx].backend_gid_index; } static void destroy_qp_hash_key(gpointer data) @@ -596,15 +596,13 @@ static void destroy_qp_hash_key(gpointer data) static void init_ports(RdmaDeviceResources *dev_res) { - int i, j; + int i; - memset(dev_res->ports, 0, sizeof(dev_res->ports)); + memset(&dev_res->port, 0, sizeof(dev_res->port)); - for (i = 0; i < MAX_PORTS; i++) { - dev_res->ports[i].state = IBV_PORT_DOWN; - for (j = 0; j < MAX_PORT_GIDS; j++) { - dev_res->ports[i].gid_tbl[j].backend_gid_index = -1; - } + dev_res->port.state = IBV_PORT_DOWN; + for (i = 0; i < MAX_PORT_GIDS; i++) { + dev_res->port.gid_tbl[i].backend_gid_index = -1; } } @@ -613,7 +611,7 @@ static void fini_ports(RdmaDeviceResources *dev_res, { int i; - dev_res->ports[0].state = IBV_PORT_DOWN; + dev_res->port.state = IBV_PORT_DOWN; for (i = 0; i < MAX_PORT_GIDS; i++) { rdma_rm_del_gid(dev_res, backend_dev, ifname, i); } diff --git a/hw/rdma/rdma_rm.h b/hw/rdma/rdma_rm.h index a7169b4e89..3c602c04c0 100644 --- a/hw/rdma/rdma_rm.h +++ b/hw/rdma/rdma_rm.h @@ -79,7 +79,7 @@ int rdma_rm_get_backend_gid_index(RdmaDeviceResources *dev_res, static inline union ibv_gid *rdma_rm_get_gid(RdmaDeviceResources *dev_res, int sgid_idx) { - return &dev_res->ports[0].gid_tbl[sgid_idx].gid; + return &dev_res->port.gid_tbl[sgid_idx].gid; } #endif diff --git a/hw/rdma/rdma_rm_defs.h b/hw/rdma/rdma_rm_defs.h index 7b3435f991..0ba61d1838 100644 --- a/hw/rdma/rdma_rm_defs.h +++ b/hw/rdma/rdma_rm_defs.h @@ -18,7 +18,7 @@ #include "rdma_backend_defs.h" -#define MAX_PORTS 1 +#define MAX_PORTS 1 /* Do not change - we support only one port */ #define MAX_PORT_GIDS 255 #define MAX_GIDS MAX_PORT_GIDS #define MAX_PORT_PKEYS 1 @@ -97,7 +97,7 @@ typedef struct RdmaRmPort { } RdmaRmPort; typedef struct RdmaDeviceResources { - RdmaRmPort ports[MAX_PORTS]; + RdmaRmPort port; RdmaRmResTbl pd_tbl; RdmaRmResTbl mr_tbl; RdmaRmResTbl uc_tbl;