aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/sa_query.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 12:39:27 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 12:39:27 -0400
commitafc2e82c0851317931a9bfdb98271253371825c6 (patch)
tree3f1c119559bd94402d0574f786851bd34bbc048f /drivers/infiniband/core/sa_query.c
parent0278ef8b484a71917bd4f03a763285cdaac10954 (diff)
parent1912ffbb88efe872eb8fa8113dfb3cb0b7238764 (diff)
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband: (49 commits) IB: Set class_dev->dev in core for nice device symlink IB/ehca: Implement modify_port IB/umad: Clarify documentation of transaction ID IPoIB/cm: spin_lock_irqsave() -> spin_lock_irq() replacements IB/mad: Change SMI to use enums rather than magic return codes IB/umad: Implement GRH handling for sent/received MADs IB/ipoib: Use ib_init_ah_from_path to initialize ah_attr IB/sa: Set src_path_bits correctly in ib_init_ah_from_path() IB/ucm: Simplify ib_ucm_event() RDMA/ucma: Simplify ucma_get_event() IB/mthca: Simplify CQ cleaning in mthca_free_qp() IB/mthca: Fix mthca_write_mtt() on HCAs with hidden memory IB/mthca: Update HCA firmware revisions IB/ipath: Fix WC format drift between user and kernel space IB/ipath: Check that a UD work request's address handle is valid IB/ipath: Remove duplicate stuff from ipath_verbs.h IB/ipath: Check reserved memory keys IB/ipath: Fix unit selection when all CPU affinity bits set IB/ipath: Don't allow QPs 0 and 1 to be opened multiple times IB/ipath: Disable IB link earlier in shutdown sequence ...
Diffstat (limited to 'drivers/infiniband/core/sa_query.c')
-rw-r--r--drivers/infiniband/core/sa_query.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 68db633711c..9a7eaadb168 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -57,6 +57,7 @@ MODULE_LICENSE("Dual BSD/GPL");
57struct ib_sa_sm_ah { 57struct ib_sa_sm_ah {
58 struct ib_ah *ah; 58 struct ib_ah *ah;
59 struct kref ref; 59 struct kref ref;
60 u8 src_path_mask;
60}; 61};
61 62
62struct ib_sa_port { 63struct ib_sa_port {
@@ -380,6 +381,7 @@ static void update_sm_ah(struct work_struct *work)
380 } 381 }
381 382
382 kref_init(&new_ah->ref); 383 kref_init(&new_ah->ref);
384 new_ah->src_path_mask = (1 << port_attr.lmc) - 1;
383 385
384 memset(&ah_attr, 0, sizeof ah_attr); 386 memset(&ah_attr, 0, sizeof ah_attr);
385 ah_attr.dlid = port_attr.sm_lid; 387 ah_attr.dlid = port_attr.sm_lid;
@@ -460,6 +462,25 @@ void ib_sa_cancel_query(int id, struct ib_sa_query *query)
460} 462}
461EXPORT_SYMBOL(ib_sa_cancel_query); 463EXPORT_SYMBOL(ib_sa_cancel_query);
462 464
465static u8 get_src_path_mask(struct ib_device *device, u8 port_num)
466{
467 struct ib_sa_device *sa_dev;
468 struct ib_sa_port *port;
469 unsigned long flags;
470 u8 src_path_mask;
471
472 sa_dev = ib_get_client_data(device, &sa_client);
473 if (!sa_dev)
474 return 0x7f;
475
476 port = &sa_dev->port[port_num - sa_dev->start_port];
477 spin_lock_irqsave(&port->ah_lock, flags);
478 src_path_mask = port->sm_ah ? port->sm_ah->src_path_mask : 0x7f;
479 spin_unlock_irqrestore(&port->ah_lock, flags);
480
481 return src_path_mask;
482}
483
463int ib_init_ah_from_path(struct ib_device *device, u8 port_num, 484int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
464 struct ib_sa_path_rec *rec, struct ib_ah_attr *ah_attr) 485 struct ib_sa_path_rec *rec, struct ib_ah_attr *ah_attr)
465{ 486{
@@ -469,7 +490,8 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
469 memset(ah_attr, 0, sizeof *ah_attr); 490 memset(ah_attr, 0, sizeof *ah_attr);
470 ah_attr->dlid = be16_to_cpu(rec->dlid); 491 ah_attr->dlid = be16_to_cpu(rec->dlid);
471 ah_attr->sl = rec->sl; 492 ah_attr->sl = rec->sl;
472 ah_attr->src_path_bits = be16_to_cpu(rec->slid) & 0x7f; 493 ah_attr->src_path_bits = be16_to_cpu(rec->slid) &
494 get_src_path_mask(device, port_num);
473 ah_attr->port_num = port_num; 495 ah_attr->port_num = port_num;
474 ah_attr->static_rate = rec->rate; 496 ah_attr->static_rate = rec->rate;
475 497