diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2006-08-21 19:40:12 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-09-22 18:22:53 -0400 |
commit | c1a0b23bf477c2e1068905f4e2b5c3cee139e853 (patch) | |
tree | 68357e32e8b6542647f639da8ca3859b4cb3b59b /drivers/infiniband/ulp | |
parent | 2439a6e65ff09729c3b4215f134dc5cd4e8a30c0 (diff) |
IB/sa: Require SA registration
Require users to register with SA module, to prevent the sa_query
module text from going away while an SA query callback is still
running. Update all in-tree users for the new interface.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 12 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 12 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 9 |
4 files changed, 25 insertions, 10 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 474aa214ab57..0b8a79d53a00 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -336,6 +336,8 @@ static inline void ipoib_unregister_debugfs(void) { } | |||
336 | extern int ipoib_sendq_size; | 336 | extern int ipoib_sendq_size; |
337 | extern int ipoib_recvq_size; | 337 | extern int ipoib_recvq_size; |
338 | 338 | ||
339 | extern struct ib_sa_client ipoib_sa_client; | ||
340 | |||
339 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG | 341 | #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG |
340 | extern int ipoib_debug_level; | 342 | extern int ipoib_debug_level; |
341 | 343 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index e9a7659eb1d7..ae3a4982cddb 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -82,6 +82,8 @@ static const u8 ipv4_bcast_addr[] = { | |||
82 | 82 | ||
83 | struct workqueue_struct *ipoib_workqueue; | 83 | struct workqueue_struct *ipoib_workqueue; |
84 | 84 | ||
85 | struct ib_sa_client ipoib_sa_client; | ||
86 | |||
85 | static void ipoib_add_one(struct ib_device *device); | 87 | static void ipoib_add_one(struct ib_device *device); |
86 | static void ipoib_remove_one(struct ib_device *device); | 88 | static void ipoib_remove_one(struct ib_device *device); |
87 | 89 | ||
@@ -463,7 +465,7 @@ static int path_rec_start(struct net_device *dev, | |||
463 | init_completion(&path->done); | 465 | init_completion(&path->done); |
464 | 466 | ||
465 | path->query_id = | 467 | path->query_id = |
466 | ib_sa_path_rec_get(priv->ca, priv->port, | 468 | ib_sa_path_rec_get(&ipoib_sa_client, priv->ca, priv->port, |
467 | &path->pathrec, | 469 | &path->pathrec, |
468 | IB_SA_PATH_REC_DGID | | 470 | IB_SA_PATH_REC_DGID | |
469 | IB_SA_PATH_REC_SGID | | 471 | IB_SA_PATH_REC_SGID | |
@@ -1191,13 +1193,16 @@ static int __init ipoib_init_module(void) | |||
1191 | goto err_fs; | 1193 | goto err_fs; |
1192 | } | 1194 | } |
1193 | 1195 | ||
1196 | ib_sa_register_client(&ipoib_sa_client); | ||
1197 | |||
1194 | ret = ib_register_client(&ipoib_client); | 1198 | ret = ib_register_client(&ipoib_client); |
1195 | if (ret) | 1199 | if (ret) |
1196 | goto err_wq; | 1200 | goto err_sa; |
1197 | 1201 | ||
1198 | return 0; | 1202 | return 0; |
1199 | 1203 | ||
1200 | err_wq: | 1204 | err_sa: |
1205 | ib_sa_unregister_client(&ipoib_sa_client); | ||
1201 | destroy_workqueue(ipoib_workqueue); | 1206 | destroy_workqueue(ipoib_workqueue); |
1202 | 1207 | ||
1203 | err_fs: | 1208 | err_fs: |
@@ -1209,6 +1214,7 @@ err_fs: | |||
1209 | static void __exit ipoib_cleanup_module(void) | 1214 | static void __exit ipoib_cleanup_module(void) |
1210 | { | 1215 | { |
1211 | ib_unregister_client(&ipoib_client); | 1216 | ib_unregister_client(&ipoib_client); |
1217 | ib_sa_unregister_client(&ipoib_sa_client); | ||
1212 | ipoib_unregister_debugfs(); | 1218 | ipoib_unregister_debugfs(); |
1213 | destroy_workqueue(ipoib_workqueue); | 1219 | destroy_workqueue(ipoib_workqueue); |
1214 | } | 1220 | } |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 60b09f5cb347..fb3e4875a46d 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -361,7 +361,7 @@ static int ipoib_mcast_sendonly_join(struct ipoib_mcast *mcast) | |||
361 | 361 | ||
362 | init_completion(&mcast->done); | 362 | init_completion(&mcast->done); |
363 | 363 | ||
364 | ret = ib_sa_mcmember_rec_set(priv->ca, priv->port, &rec, | 364 | ret = ib_sa_mcmember_rec_set(&ipoib_sa_client, priv->ca, priv->port, &rec, |
365 | IB_SA_MCMEMBER_REC_MGID | | 365 | IB_SA_MCMEMBER_REC_MGID | |
366 | IB_SA_MCMEMBER_REC_PORT_GID | | 366 | IB_SA_MCMEMBER_REC_PORT_GID | |
367 | IB_SA_MCMEMBER_REC_PKEY | | 367 | IB_SA_MCMEMBER_REC_PKEY | |
@@ -485,9 +485,9 @@ static void ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast, | |||
485 | 485 | ||
486 | init_completion(&mcast->done); | 486 | init_completion(&mcast->done); |
487 | 487 | ||
488 | ret = ib_sa_mcmember_rec_set(priv->ca, priv->port, &rec, comp_mask, | 488 | ret = ib_sa_mcmember_rec_set(&ipoib_sa_client, priv->ca, priv->port, |
489 | mcast->backoff * 1000, GFP_ATOMIC, | 489 | &rec, comp_mask, mcast->backoff * 1000, |
490 | ipoib_mcast_join_complete, | 490 | GFP_ATOMIC, ipoib_mcast_join_complete, |
491 | mcast, &mcast->query); | 491 | mcast, &mcast->query); |
492 | 492 | ||
493 | if (ret < 0) { | 493 | if (ret < 0) { |
@@ -528,7 +528,7 @@ void ipoib_mcast_join_task(void *dev_ptr) | |||
528 | priv->local_rate = attr.active_speed * | 528 | priv->local_rate = attr.active_speed * |
529 | ib_width_enum_to_int(attr.active_width); | 529 | ib_width_enum_to_int(attr.active_width); |
530 | } else | 530 | } else |
531 | ipoib_warn(priv, "ib_query_port failed\n"); | 531 | ipoib_warn(priv, "ib_query_port failed\n"); |
532 | } | 532 | } |
533 | 533 | ||
534 | if (!priv->broadcast) { | 534 | if (!priv->broadcast) { |
@@ -681,7 +681,7 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) | |||
681 | * Just make one shot at leaving and don't wait for a reply; | 681 | * Just make one shot at leaving and don't wait for a reply; |
682 | * if we fail, too bad. | 682 | * if we fail, too bad. |
683 | */ | 683 | */ |
684 | ret = ib_sa_mcmember_rec_delete(priv->ca, priv->port, &rec, | 684 | ret = ib_sa_mcmember_rec_delete(&ipoib_sa_client, priv->ca, priv->port, &rec, |
685 | IB_SA_MCMEMBER_REC_MGID | | 685 | IB_SA_MCMEMBER_REC_MGID | |
686 | IB_SA_MCMEMBER_REC_PORT_GID | | 686 | IB_SA_MCMEMBER_REC_PORT_GID | |
687 | IB_SA_MCMEMBER_REC_PKEY | | 687 | IB_SA_MCMEMBER_REC_PKEY | |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index feb1fcd0f2fb..44b9e5be6687 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -96,6 +96,8 @@ static struct ib_client srp_client = { | |||
96 | .remove = srp_remove_one | 96 | .remove = srp_remove_one |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static struct ib_sa_client srp_sa_client; | ||
100 | |||
99 | static inline struct srp_target_port *host_to_target(struct Scsi_Host *host) | 101 | static inline struct srp_target_port *host_to_target(struct Scsi_Host *host) |
100 | { | 102 | { |
101 | return (struct srp_target_port *) host->hostdata; | 103 | return (struct srp_target_port *) host->hostdata; |
@@ -267,7 +269,8 @@ static int srp_lookup_path(struct srp_target_port *target) | |||
267 | 269 | ||
268 | init_completion(&target->done); | 270 | init_completion(&target->done); |
269 | 271 | ||
270 | target->path_query_id = ib_sa_path_rec_get(target->srp_host->dev->dev, | 272 | target->path_query_id = ib_sa_path_rec_get(&srp_sa_client, |
273 | target->srp_host->dev->dev, | ||
271 | target->srp_host->port, | 274 | target->srp_host->port, |
272 | &target->path, | 275 | &target->path, |
273 | IB_SA_PATH_REC_DGID | | 276 | IB_SA_PATH_REC_DGID | |
@@ -1998,9 +2001,12 @@ static int __init srp_init_module(void) | |||
1998 | return ret; | 2001 | return ret; |
1999 | } | 2002 | } |
2000 | 2003 | ||
2004 | ib_sa_register_client(&srp_sa_client); | ||
2005 | |||
2001 | ret = ib_register_client(&srp_client); | 2006 | ret = ib_register_client(&srp_client); |
2002 | if (ret) { | 2007 | if (ret) { |
2003 | printk(KERN_ERR PFX "couldn't register IB client\n"); | 2008 | printk(KERN_ERR PFX "couldn't register IB client\n"); |
2009 | ib_sa_unregister_client(&srp_sa_client); | ||
2004 | class_unregister(&srp_class); | 2010 | class_unregister(&srp_class); |
2005 | return ret; | 2011 | return ret; |
2006 | } | 2012 | } |
@@ -2011,6 +2017,7 @@ static int __init srp_init_module(void) | |||
2011 | static void __exit srp_cleanup_module(void) | 2017 | static void __exit srp_cleanup_module(void) |
2012 | { | 2018 | { |
2013 | ib_unregister_client(&srp_client); | 2019 | ib_unregister_client(&srp_client); |
2020 | ib_sa_unregister_client(&srp_sa_client); | ||
2014 | class_unregister(&srp_class); | 2021 | class_unregister(&srp_class); |
2015 | } | 2022 | } |
2016 | 2023 | ||