[ofa-general] [PATCH 2/6 v2] fix pkey change handling and remove the cahce

Yosef Etigin yosefe at voltaire.com
Mon May 7 05:55:40 PDT 2007


core, ulp: don't use ib_cahce

* Modify users of the ib cache in: core, ipoib, srp, to use
  blocking device queries.

Signed-off-by: Yosef Etigin <yosefe at voltaire.com>
---
 drivers/infiniband/core/cm.c            |    8 ++++----
 drivers/infiniband/core/cma.c           |    9 ++++-----
 drivers/infiniband/core/multicast.c     |    3 +--
 drivers/infiniband/core/sa_query.c      |    3 +--
 drivers/infiniband/core/verbs.c         |    3 +--
 drivers/infiniband/ulp/ipoib/ipoib_cm.c |    3 +--
 drivers/infiniband/ulp/ipoib/ipoib_ib.c |    4 ++--
 drivers/infiniband/ulp/srp/ib_srp.c     |    6 ++----
 8 files changed, 16 insertions(+), 23 deletions(-)

Index: b/drivers/infiniband/core/cm.c
===================================================================
--- a/drivers/infiniband/core/cm.c	2007-05-06 09:26:12.000000000 +0300
+++ b/drivers/infiniband/core/cm.c	2007-05-06 09:26:17.000000000 +0300
@@ -46,8 +46,8 @@
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
 
-#include <rdma/ib_cache.h>
 #include <rdma/ib_cm.h>
+#include <rdma/ib_verbs.h>
 #include "cm_msgs.h"
 
 MODULE_AUTHOR("Sean Hefty");
@@ -275,7 +275,7 @@ static int cm_init_av_by_path(struct ib_
 
 	read_lock_irqsave(&cm.device_lock, flags);
 	list_for_each_entry(cm_dev, &cm.device_list, list) {
-		if (!ib_find_cached_gid(cm_dev->device, &path->sgid,
+		if (!ib_find_gid(cm_dev->device, &path->sgid,
 					&p, NULL)) {
 			port = &cm_dev->port[p-1];
 			break;
@@ -286,7 +286,7 @@ static int cm_init_av_by_path(struct ib_
 	if (!port)
 		return -EINVAL;
 
-	ret = ib_find_cached_pkey(cm_dev->device, port->port_num,
+	ret = ib_find_pkey(cm_dev->device, port->port_num,
 				  be16_to_cpu(path->pkey), &av->pkey_index);
 	if (ret)
 		return ret;
@@ -1382,7 +1382,7 @@ static int cm_req_handler(struct cm_work
 	cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]);
 	ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
 	if (ret) {
-		ib_get_cached_gid(work->port->cm_dev->device,
+		ib_query_gid(work->port->cm_dev->device,
 				  work->port->port_num, 0, &work->path[0].sgid);
 		ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID,
 			       &work->path[0].sgid, sizeof work->path[0].sgid,
Index: b/drivers/infiniband/core/cma.c
===================================================================
--- a/drivers/infiniband/core/cma.c	2007-05-06 09:26:12.000000000 +0300
+++ b/drivers/infiniband/core/cma.c	2007-05-06 09:26:17.000000000 +0300
@@ -41,7 +41,6 @@
 
 #include <rdma/rdma_cm.h>
 #include <rdma/rdma_cm_ib.h>
-#include <rdma/ib_cache.h>
 #include <rdma/ib_cm.h>
 #include <rdma/ib_sa.h>
 #include <rdma/iw_cm.h>
@@ -325,7 +324,7 @@ static int cma_acquire_dev(struct rdma_i
 	}
 
 	list_for_each_entry(cma_dev, &dev_list, list) {
-		ret = ib_find_cached_gid(cma_dev->device, &gid,
+		ret = ib_find_gid(cma_dev->device, &gid,
 					 &id_priv->id.port_num, NULL);
 		if (!ret) {
 			ret = cma_set_qkey(cma_dev->device,
@@ -514,7 +513,7 @@ static int cma_ib_init_qp_attr(struct rd
 	struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
 	int ret;
 
-	ret = ib_find_cached_pkey(id_priv->id.device, id_priv->id.port_num,
+	ret = ib_find_pkey(id_priv->id.device, id_priv->id.port_num,
 				  ib_addr_get_pkey(dev_addr),
 				  &qp_attr->pkey_index);
 	if (ret)
@@ -1658,11 +1657,11 @@ static int cma_bind_loopback(struct rdma
 	cma_dev = list_entry(dev_list.next, struct cma_device, list);
 
 port_found:
-	ret = ib_get_cached_gid(cma_dev->device, p, 0, &gid);
+	ret = ib_query_gid(cma_dev->device, p, 0, &gid);
 	if (ret)
 		goto out;
 
-	ret = ib_get_cached_pkey(cma_dev->device, p, 0, &pkey);
+	ret = ib_query_pkey(cma_dev->device, p, 0, &pkey);
 	if (ret)
 		goto out;
 
Index: b/drivers/infiniband/core/multicast.c
===================================================================
--- a/drivers/infiniband/core/multicast.c	2007-05-06 09:26:12.000000000 +0300
+++ b/drivers/infiniband/core/multicast.c	2007-05-06 09:26:17.000000000 +0300
@@ -38,7 +38,6 @@
 #include <linux/bitops.h>
 #include <linux/random.h>
 
-#include <rdma/ib_cache.h>
 #include "sa.h"
 
 static void mcast_add_one(struct ib_device *device);
@@ -686,7 +685,7 @@ int ib_init_ah_from_mcmember(struct ib_d
 	u16 gid_index;
 	u8 p;
 
-	ret = ib_find_cached_gid(device, &rec->port_gid, &p, &gid_index);
+	ret = ib_find_gid(device, &rec->port_gid, &p, &gid_index);
 	if (ret)
 		return ret;
 
Index: b/drivers/infiniband/core/sa_query.c
===================================================================
--- a/drivers/infiniband/core/sa_query.c	2007-05-06 09:26:12.000000000 +0300
+++ b/drivers/infiniband/core/sa_query.c	2007-05-06 09:26:17.000000000 +0300
@@ -47,7 +47,6 @@
 #include <linux/workqueue.h>
 
 #include <rdma/ib_pack.h>
-#include <rdma/ib_cache.h>
 #include "sa.h"
 
 MODULE_AUTHOR("Roland Dreier");
@@ -477,7 +476,7 @@ int ib_init_ah_from_path(struct ib_devic
 		ah_attr->ah_flags = IB_AH_GRH;
 		ah_attr->grh.dgid = rec->dgid;
 
-		ret = ib_find_cached_gid(device, &rec->sgid, &port_num,
+		ret = ib_find_gid(device, &rec->sgid, &port_num,
 					 &gid_index);
 		if (ret)
 			return ret;
Index: b/drivers/infiniband/core/verbs.c
===================================================================
--- a/drivers/infiniband/core/verbs.c	2007-05-06 09:26:12.000000000 +0300
+++ b/drivers/infiniband/core/verbs.c	2007-05-06 09:26:17.000000000 +0300
@@ -43,7 +43,6 @@
 #include <linux/string.h>
 
 #include <rdma/ib_verbs.h>
-#include <rdma/ib_cache.h>
 
 int ib_rate_to_mult(enum ib_rate rate)
 {
@@ -159,7 +158,7 @@ int ib_init_ah_from_wc(struct ib_device 
 		ah_attr->ah_flags = IB_AH_GRH;
 		ah_attr->grh.dgid = grh->sgid;
 
-		ret = ib_find_cached_gid(device, &grh->dgid, &port_num,
+		ret = ib_find_gid(device, &grh->dgid, &port_num,
 					 &gid_index);
 		if (ret)
 			return ret;
Index: b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
===================================================================
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c	2007-05-06 09:26:12.000000000 +0300
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c	2007-05-06 09:26:17.000000000 +0300
@@ -33,7 +33,6 @@
  */
 
 #include <rdma/ib_cm.h>
-#include <rdma/ib_cache.h>
 #include <net/dst.h>
 #include <net/icmp.h>
 #include <linux/icmpv6.h>
@@ -759,7 +758,7 @@ static int ipoib_cm_modify_tx_init(struc
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
 	struct ib_qp_attr qp_attr;
 	int qp_attr_mask, ret;
-	ret = ib_find_cached_pkey(priv->ca, priv->port, priv->pkey, &qp_attr.pkey_index);
+	ret = ib_find_pkey(priv->ca, priv->port, priv->pkey, &qp_attr.pkey_index);
 	if (ret) {
 		ipoib_warn(priv, "pkey 0x%x not in cache: %d\n", priv->pkey, ret);
 		return ret;
Index: b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
===================================================================
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2007-05-06 09:26:12.000000000 +0300
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c	2007-05-07 14:28:48.625133165 +0300
@@ -38,7 +38,7 @@
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
 
-#include <rdma/ib_cache.h>
+#include <rdma/ib_verbs.h>
 
 #include "ipoib.h"
 
@@ -446,7 +446,7 @@ static void ipoib_pkey_dev_check_presenc
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
 	u16 pkey_index = 0;
 
-	if (ib_find_cached_pkey(priv->ca, priv->port, priv->pkey, &pkey_index))
+	if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &pkey_index))
 		clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
 	else
 		set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags);
Index: b/drivers/infiniband/ulp/srp/ib_srp.c
===================================================================
--- a/drivers/infiniband/ulp/srp/ib_srp.c	2007-05-06 09:26:12.000000000 +0300
+++ b/drivers/infiniband/ulp/srp/ib_srp.c	2007-05-06 09:26:17.000000000 +0300
@@ -48,8 +48,6 @@
 #include <scsi/scsi_dbg.h>
 #include <scsi/srp.h>
 
-#include <rdma/ib_cache.h>
-
 #include "ib_srp.h"
 
 #define DRV_NAME	"ib_srp"
@@ -164,7 +162,7 @@ static int srp_init_qp(struct srp_target
 	if (!attr)
 		return -ENOMEM;
 
-	ret = ib_find_cached_pkey(target->srp_host->dev->dev,
+	ret = ib_find_pkey(target->srp_host->dev->dev,
 				  target->srp_host->port,
 				  be16_to_cpu(target->path.pkey),
 				  &attr->pkey_index);
@@ -1780,7 +1778,7 @@ static ssize_t srp_create_target(struct 
 	if (ret)
 		goto err;
 
-	ib_get_cached_gid(host->dev->dev, host->port, 0, &target->path.sgid);
+	ib_query_gid(host->dev->dev, host->port, 0, &target->path.sgid);
 
 	printk(KERN_DEBUG PFX "new target: id_ext %016llx ioc_guid %016llx pkey %04x "
 	       "service_id %016llx dgid %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",




More information about the general mailing list