mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anand Khoje <anand.a.khoje@oracle.com>
To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: dledford@redhat.com, jgg@ziepe.ca, haakon.bugge@oracle.com,
	leon@kernel.org
Subject: [PATCH v7 for-next 3/3] IB/core: Read subnet_prefix in ib_query_port via cache.
Date: Wed, 30 Jun 2021 15:16:15 +0530	[thread overview]
Message-ID: <20210630094615.808-4-anand.a.khoje@oracle.com> (raw)
In-Reply-To: <20210630094615.808-1-anand.a.khoje@oracle.com>

ib_query_port() calls device->ops.query_port() to get the port
attributes. The method of querying is device driver specific.
The same function calls device->ops.query_gid() to get the GID and
extract the subnet_prefix (gid_prefix).

The GID and subnet_prefix are stored in a cache. But they do not get
read from the cache if the device is an Infiniband device. The
following change takes advantage of the cached subnet_prefix.
Testing with RDBMS has shown a significant improvement in performance
with this change.

Fixes: fad61ad ("IB/core: Add subnet prefix to port info")
Signed-off-by: Anand Khoje <anand.a.khoje@oracle.com>
Signed-off-by: Haakon Bugge <haakon.bugge@oracle.com>
---
 drivers/infiniband/core/device.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index ba0ad72..9056f48 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2052,7 +2052,6 @@ static int __ib_query_port(struct ib_device *device,
 			   u32 port_num,
 			   struct ib_port_attr *port_attr)
 {
-	union ib_gid gid = {};
 	int err;
 
 	memset(port_attr, 0, sizeof(*port_attr));
@@ -2065,11 +2064,8 @@ static int __ib_query_port(struct ib_device *device,
 	    IB_LINK_LAYER_INFINIBAND)
 		return 0;
 
-	err = device->ops.query_gid(device, port_num, 0, &gid);
-	if (err)
-		return err;
-
-	port_attr->subnet_prefix = be64_to_cpu(gid.global.subnet_prefix);
+	ib_get_cached_subnet_prefix(device, port_num,
+				    &port_attr->subnet_prefix);
 	return 0;
 }
 
-- 
1.8.3.1


  parent reply	other threads:[~2021-06-30  9:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30  9:46 [PATCH v7 for-next 0/3] IB/core: Obtaining subnet_prefix from cache in Anand Khoje
2021-06-30  9:46 ` [PATCH v7 for-next 1/3] IB/core: Updating cache for subnet_prefix in config_non_roce_gid_cache() Anand Khoje
2021-06-30  9:46 ` [PATCH v7 for-next 2/3] IB/core: Shifting initialization of device->cache_lock Anand Khoje
2021-06-30  9:46 ` Anand Khoje [this message]
2021-07-06  7:25 ` [PATCH v7 for-next 0/3] IB/core: Obtaining subnet_prefix from cache in Anand Khoje
2021-07-09 13:21   ` Jason Gunthorpe
2021-07-09 14:46     ` Anand Khoje

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210630094615.808-4-anand.a.khoje@oracle.com \
    --to=anand.a.khoje@oracle.com \
    --cc=dledford@redhat.com \
    --cc=haakon.bugge@oracle.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®