From nobody Thu Nov 6 14:20:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541422593789814.6794087384751; Mon, 5 Nov 2018 04:56:33 -0800 (PST) Received: from localhost ([::1]:34891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJeQi-0001ci-F8 for importer@patchew.org; Mon, 05 Nov 2018 07:56:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJeHZ-0007n5-F8 for qemu-devel@nongnu.org; Mon, 05 Nov 2018 07:47:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJeHW-0003ba-99 for qemu-devel@nongnu.org; Mon, 05 Nov 2018 07:47:05 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:40094) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJeHW-0003bO-2g for qemu-devel@nongnu.org; Mon, 05 Nov 2018 07:47:02 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wA5CiHgs060573; Mon, 5 Nov 2018 12:47:00 GMT Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2nh3mpeexa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 05 Nov 2018 12:47:00 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wA5CkxL0002394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 5 Nov 2018 12:47:00 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wA5CkxpF022806; Mon, 5 Nov 2018 12:46:59 GMT Received: from localhost.localdomain (/77.138.186.148) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Nov 2018 04:46:58 -0800 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=gqDwUx71I6i9g05jiCYuP1vaR3n2sf1/B0jjcZGSRZI=; b=vSxKef/he0HE7oglmkADuT3wbXK8X1K3IwsFs+vfiNh9m5QwN2JqOwx0V4IG06g2/b1R lUTrfHnxRucOpivFa5aZOcioA6QCp9RPyQPnxYypUC3+v9a3Y8qzBdqqTqkqo5AE5lUh HZN9AFE14WsPiutrwCiyC/inCZnxtc5QjM3T602xbcYDO/TjvmoVkxig8xXFB6NTCurM nt6tPshqLFF1D/l1MIVRwxVqhb94iL2dsS1MUjadyD0LcXb/3bcBKqyHNLLH6Xzi8P9u iTx92sQvVfa+eyh7tZvPh3ToqTGTuLPLJX7HXsp5OwDQyzQ45nxDp8ygpFrVMW4T7+6K OA== 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, shamir.rabinovitch@oracle.com, qemu-devel@nongnu.org Date: Mon, 5 Nov 2018 14:45:59 +0200 Message-Id: <20181105124559.21561-19-yuval.shaia@oracle.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181105124559.21561-1-yuval.shaia@oracle.com> References: <20181105124559.21561-1-yuval.shaia@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9067 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811050118 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 141.146.126.78 Subject: [Qemu-devel] [PATCH 18/18] 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Device supports only one port, let's remove a dead code that handles more than one port. Signed-off-by: Yuval Shaia --- 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 04f88139c2..a743cc42fe 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, RdmaB= ackendDev *backend_dev, return -EINVAL; } =20 - 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)); =20 return 0; } @@ -556,14 +556,14 @@ void rdma_rm_del_gid(RdmaDeviceResources *dev_res, Rd= maBackendDev *backend_dev, int rc; =20 rc =3D 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 < 0) { pr_dbg("Fail to delete gid\n"); } =20 - 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 =3D -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 =3D -1; } =20 int rdma_rm_get_backend_gid_index(RdmaDeviceResources *dev_res, @@ -574,16 +574,16 @@ int rdma_rm_get_backend_gid_index(RdmaDeviceResources= *dev_res, return -EINVAL; } =20 - if (unlikely(dev_res->ports[0].gid_tbl[sgid_idx].backend_gid_index =3D= =3D -1)) { - dev_res->ports[0].gid_tbl[sgid_idx].backend_gid_index =3D + if (unlikely(dev_res->port.gid_tbl[sgid_idx].backend_gid_index =3D=3D = -1)) { + dev_res->port.gid_tbl[sgid_idx].backend_gid_index =3D rdma_backend_get_gid_index(backend_dev, - &dev_res->ports[0].gid_tbl[sgid_idx= ].gid); + &dev_res->port.gid_tbl[sgid_idx].gid); } =20 pr_dbg("backend_gid_index=3D%d\n", - dev_res->ports[0].gid_tbl[sgid_idx].backend_gid_index); + dev_res->port.gid_tbl[sgid_idx].backend_gid_index); =20 - return dev_res->ports[0].gid_tbl[sgid_idx].backend_gid_index; + return dev_res->port.gid_tbl[sgid_idx].backend_gid_index; } =20 static void destroy_qp_hash_key(gpointer data) @@ -593,15 +593,13 @@ static void destroy_qp_hash_key(gpointer data) =20 static void init_ports(RdmaDeviceResources *dev_res) { - int i, j; + int i; =20 - memset(dev_res->ports, 0, sizeof(dev_res->ports)); + memset(&dev_res->port, 0, sizeof(dev_res->port)); =20 - for (i =3D 0; i < MAX_PORTS; i++) { - dev_res->ports[i].state =3D IBV_PORT_DOWN; - for (j =3D 0; j < MAX_PORT_GIDS; j++) { - dev_res->ports[i].gid_tbl[j].backend_gid_index =3D -1; - } + dev_res->port.state =3D IBV_PORT_DOWN; + for (i =3D 0; i < MAX_PORT_GIDS; i++) { + dev_res->port.gid_tbl[i].backend_gid_index =3D -1; } } =20 @@ -610,7 +608,7 @@ static void fini_ports(RdmaDeviceResources *dev_res, { int i; =20 - dev_res->ports[0].state =3D IBV_PORT_DOWN; + dev_res->port.state =3D IBV_PORT_DOWN; for (i =3D 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 89596f4de1..140c0cea97 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 *de= v_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; } =20 #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 @@ =20 #include "rdma_backend_defs.h" =20 -#define MAX_PORTS 1 +#define MAX_PORTS 1 /* Do not change - we support only one por= t */ #define MAX_PORT_GIDS 255 #define MAX_GIDS MAX_PORT_GIDS #define MAX_PORT_PKEYS 1 @@ -97,7 +97,7 @@ typedef struct RdmaRmPort { } RdmaRmPort; =20 typedef struct RdmaDeviceResources { - RdmaRmPort ports[MAX_PORTS]; + RdmaRmPort port; RdmaRmResTbl pd_tbl; RdmaRmResTbl mr_tbl; RdmaRmResTbl uc_tbl; --=20 2.17.2