aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
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/ulp
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/ulp')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c64
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c8
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c12
3 files changed, 36 insertions, 48 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index c722e5c141b3..0c4e59b906cd 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -228,7 +228,6 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
228 struct net_device *dev = cm_id->context; 228 struct net_device *dev = cm_id->context;
229 struct ipoib_dev_priv *priv = netdev_priv(dev); 229 struct ipoib_dev_priv *priv = netdev_priv(dev);
230 struct ipoib_cm_rx *p; 230 struct ipoib_cm_rx *p;
231 unsigned long flags;
232 unsigned psn; 231 unsigned psn;
233 int ret; 232 int ret;
234 233
@@ -257,9 +256,9 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
257 256
258 cm_id->context = p; 257 cm_id->context = p;
259 p->jiffies = jiffies; 258 p->jiffies = jiffies;
260 spin_lock_irqsave(&priv->lock, flags); 259 spin_lock_irq(&priv->lock);
261 list_add(&p->list, &priv->cm.passive_ids); 260 list_add(&p->list, &priv->cm.passive_ids);
262 spin_unlock_irqrestore(&priv->lock, flags); 261 spin_unlock_irq(&priv->lock);
263 queue_delayed_work(ipoib_workqueue, 262 queue_delayed_work(ipoib_workqueue,
264 &priv->cm.stale_task, IPOIB_CM_RX_DELAY); 263 &priv->cm.stale_task, IPOIB_CM_RX_DELAY);
265 return 0; 264 return 0;
@@ -277,7 +276,6 @@ static int ipoib_cm_rx_handler(struct ib_cm_id *cm_id,
277{ 276{
278 struct ipoib_cm_rx *p; 277 struct ipoib_cm_rx *p;
279 struct ipoib_dev_priv *priv; 278 struct ipoib_dev_priv *priv;
280 unsigned long flags;
281 int ret; 279 int ret;
282 280
283 switch (event->event) { 281 switch (event->event) {
@@ -290,14 +288,14 @@ static int ipoib_cm_rx_handler(struct ib_cm_id *cm_id,
290 case IB_CM_REJ_RECEIVED: 288 case IB_CM_REJ_RECEIVED:
291 p = cm_id->context; 289 p = cm_id->context;
292 priv = netdev_priv(p->dev); 290 priv = netdev_priv(p->dev);
293 spin_lock_irqsave(&priv->lock, flags); 291 spin_lock_irq(&priv->lock);
294 if (list_empty(&p->list)) 292 if (list_empty(&p->list))
295 ret = 0; /* Connection is going away already. */ 293 ret = 0; /* Connection is going away already. */
296 else { 294 else {
297 list_del_init(&p->list); 295 list_del_init(&p->list);
298 ret = -ECONNRESET; 296 ret = -ECONNRESET;
299 } 297 }
300 spin_unlock_irqrestore(&priv->lock, flags); 298 spin_unlock_irq(&priv->lock);
301 if (ret) { 299 if (ret) {
302 ib_destroy_qp(p->qp); 300 ib_destroy_qp(p->qp);
303 kfree(p); 301 kfree(p);
@@ -351,8 +349,8 @@ void ipoib_cm_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
351 u64 mapping[IPOIB_CM_RX_SG]; 349 u64 mapping[IPOIB_CM_RX_SG];
352 int frags; 350 int frags;
353 351
354 ipoib_dbg_data(priv, "cm recv completion: id %d, op %d, status: %d\n", 352 ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n",
355 wr_id, wc->opcode, wc->status); 353 wr_id, wc->status);
356 354
357 if (unlikely(wr_id >= ipoib_recvq_size)) { 355 if (unlikely(wr_id >= ipoib_recvq_size)) {
358 ipoib_warn(priv, "cm recv completion event with wrid %d (> %d)\n", 356 ipoib_warn(priv, "cm recv completion event with wrid %d (> %d)\n",
@@ -504,8 +502,8 @@ static void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ipoib_cm_tx *tx
504 struct ipoib_tx_buf *tx_req; 502 struct ipoib_tx_buf *tx_req;
505 unsigned long flags; 503 unsigned long flags;
506 504
507 ipoib_dbg_data(priv, "cm send completion: id %d, op %d, status: %d\n", 505 ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n",
508 wr_id, wc->opcode, wc->status); 506 wr_id, wc->status);
509 507
510 if (unlikely(wr_id >= ipoib_sendq_size)) { 508 if (unlikely(wr_id >= ipoib_sendq_size)) {
511 ipoib_warn(priv, "cm send completion event with wrid %d (> %d)\n", 509 ipoib_warn(priv, "cm send completion event with wrid %d (> %d)\n",
@@ -612,23 +610,22 @@ void ipoib_cm_dev_stop(struct net_device *dev)
612{ 610{
613 struct ipoib_dev_priv *priv = netdev_priv(dev); 611 struct ipoib_dev_priv *priv = netdev_priv(dev);
614 struct ipoib_cm_rx *p; 612 struct ipoib_cm_rx *p;
615 unsigned long flags;
616 613
617 if (!IPOIB_CM_SUPPORTED(dev->dev_addr)) 614 if (!IPOIB_CM_SUPPORTED(dev->dev_addr))
618 return; 615 return;
619 616
620 ib_destroy_cm_id(priv->cm.id); 617 ib_destroy_cm_id(priv->cm.id);
621 spin_lock_irqsave(&priv->lock, flags); 618 spin_lock_irq(&priv->lock);
622 while (!list_empty(&priv->cm.passive_ids)) { 619 while (!list_empty(&priv->cm.passive_ids)) {
623 p = list_entry(priv->cm.passive_ids.next, typeof(*p), list); 620 p = list_entry(priv->cm.passive_ids.next, typeof(*p), list);
624 list_del_init(&p->list); 621 list_del_init(&p->list);
625 spin_unlock_irqrestore(&priv->lock, flags); 622 spin_unlock_irq(&priv->lock);
626 ib_destroy_cm_id(p->id); 623 ib_destroy_cm_id(p->id);
627 ib_destroy_qp(p->qp); 624 ib_destroy_qp(p->qp);
628 kfree(p); 625 kfree(p);
629 spin_lock_irqsave(&priv->lock, flags); 626 spin_lock_irq(&priv->lock);
630 } 627 }
631 spin_unlock_irqrestore(&priv->lock, flags); 628 spin_unlock_irq(&priv->lock);
632 629
633 cancel_delayed_work(&priv->cm.stale_task); 630 cancel_delayed_work(&priv->cm.stale_task);
634} 631}
@@ -642,7 +639,6 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
642 struct ib_qp_attr qp_attr; 639 struct ib_qp_attr qp_attr;
643 int qp_attr_mask, ret; 640 int qp_attr_mask, ret;
644 struct sk_buff *skb; 641 struct sk_buff *skb;
645 unsigned long flags;
646 642
647 p->mtu = be32_to_cpu(data->mtu); 643 p->mtu = be32_to_cpu(data->mtu);
648 644
@@ -680,12 +676,12 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
680 676
681 skb_queue_head_init(&skqueue); 677 skb_queue_head_init(&skqueue);
682 678
683 spin_lock_irqsave(&priv->lock, flags); 679 spin_lock_irq(&priv->lock);
684 set_bit(IPOIB_FLAG_OPER_UP, &p->flags); 680 set_bit(IPOIB_FLAG_OPER_UP, &p->flags);
685 if (p->neigh) 681 if (p->neigh)
686 while ((skb = __skb_dequeue(&p->neigh->queue))) 682 while ((skb = __skb_dequeue(&p->neigh->queue)))
687 __skb_queue_tail(&skqueue, skb); 683 __skb_queue_tail(&skqueue, skb);
688 spin_unlock_irqrestore(&priv->lock, flags); 684 spin_unlock_irq(&priv->lock);
689 685
690 while ((skb = __skb_dequeue(&skqueue))) { 686 while ((skb = __skb_dequeue(&skqueue))) {
691 skb->dev = p->dev; 687 skb->dev = p->dev;
@@ -895,7 +891,6 @@ static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id,
895 struct ipoib_dev_priv *priv = netdev_priv(tx->dev); 891 struct ipoib_dev_priv *priv = netdev_priv(tx->dev);
896 struct net_device *dev = priv->dev; 892 struct net_device *dev = priv->dev;
897 struct ipoib_neigh *neigh; 893 struct ipoib_neigh *neigh;
898 unsigned long flags;
899 int ret; 894 int ret;
900 895
901 switch (event->event) { 896 switch (event->event) {
@@ -914,7 +909,7 @@ static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id,
914 case IB_CM_REJ_RECEIVED: 909 case IB_CM_REJ_RECEIVED:
915 case IB_CM_TIMEWAIT_EXIT: 910 case IB_CM_TIMEWAIT_EXIT:
916 ipoib_dbg(priv, "CM error %d.\n", event->event); 911 ipoib_dbg(priv, "CM error %d.\n", event->event);
917 spin_lock_irqsave(&priv->tx_lock, flags); 912 spin_lock_irq(&priv->tx_lock);
918 spin_lock(&priv->lock); 913 spin_lock(&priv->lock);
919 neigh = tx->neigh; 914 neigh = tx->neigh;
920 915
@@ -934,7 +929,7 @@ static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id,
934 } 929 }
935 930
936 spin_unlock(&priv->lock); 931 spin_unlock(&priv->lock);
937 spin_unlock_irqrestore(&priv->tx_lock, flags); 932 spin_unlock_irq(&priv->tx_lock);
938 break; 933 break;
939 default: 934 default:
940 break; 935 break;
@@ -1023,21 +1018,20 @@ static void ipoib_cm_tx_reap(struct work_struct *work)
1023 struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, 1018 struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv,
1024 cm.reap_task); 1019 cm.reap_task);
1025 struct ipoib_cm_tx *p; 1020 struct ipoib_cm_tx *p;
1026 unsigned long flags;
1027 1021
1028 spin_lock_irqsave(&priv->tx_lock, flags); 1022 spin_lock_irq(&priv->tx_lock);
1029 spin_lock(&priv->lock); 1023 spin_lock(&priv->lock);
1030 while (!list_empty(&priv->cm.reap_list)) { 1024 while (!list_empty(&priv->cm.reap_list)) {
1031 p = list_entry(priv->cm.reap_list.next, typeof(*p), list); 1025 p = list_entry(priv->cm.reap_list.next, typeof(*p), list);
1032 list_del(&p->list); 1026 list_del(&p->list);
1033 spin_unlock(&priv->lock); 1027 spin_unlock(&priv->lock);
1034 spin_unlock_irqrestore(&priv->tx_lock, flags); 1028 spin_unlock_irq(&priv->tx_lock);
1035 ipoib_cm_tx_destroy(p); 1029 ipoib_cm_tx_destroy(p);
1036 spin_lock_irqsave(&priv->tx_lock, flags); 1030 spin_lock_irq(&priv->tx_lock);
1037 spin_lock(&priv->lock); 1031 spin_lock(&priv->lock);
1038 } 1032 }
1039 spin_unlock(&priv->lock); 1033 spin_unlock(&priv->lock);
1040 spin_unlock_irqrestore(&priv->tx_lock, flags); 1034 spin_unlock_irq(&priv->tx_lock);
1041} 1035}
1042 1036
1043static void ipoib_cm_skb_reap(struct work_struct *work) 1037static void ipoib_cm_skb_reap(struct work_struct *work)
@@ -1046,15 +1040,14 @@ static void ipoib_cm_skb_reap(struct work_struct *work)
1046 cm.skb_task); 1040 cm.skb_task);
1047 struct net_device *dev = priv->dev; 1041 struct net_device *dev = priv->dev;
1048 struct sk_buff *skb; 1042 struct sk_buff *skb;
1049 unsigned long flags;
1050 1043
1051 unsigned mtu = priv->mcast_mtu; 1044 unsigned mtu = priv->mcast_mtu;
1052 1045
1053 spin_lock_irqsave(&priv->tx_lock, flags); 1046 spin_lock_irq(&priv->tx_lock);
1054 spin_lock(&priv->lock); 1047 spin_lock(&priv->lock);
1055 while ((skb = skb_dequeue(&priv->cm.skb_queue))) { 1048 while ((skb = skb_dequeue(&priv->cm.skb_queue))) {
1056 spin_unlock(&priv->lock); 1049 spin_unlock(&priv->lock);
1057 spin_unlock_irqrestore(&priv->tx_lock, flags); 1050 spin_unlock_irq(&priv->tx_lock);
1058 if (skb->protocol == htons(ETH_P_IP)) 1051 if (skb->protocol == htons(ETH_P_IP))
1059 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); 1052 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
1060#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 1053#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -1062,11 +1055,11 @@ static void ipoib_cm_skb_reap(struct work_struct *work)
1062 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, dev); 1055 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, dev);
1063#endif 1056#endif
1064 dev_kfree_skb_any(skb); 1057 dev_kfree_skb_any(skb);
1065 spin_lock_irqsave(&priv->tx_lock, flags); 1058 spin_lock_irq(&priv->tx_lock);
1066 spin_lock(&priv->lock); 1059 spin_lock(&priv->lock);
1067 } 1060 }
1068 spin_unlock(&priv->lock); 1061 spin_unlock(&priv->lock);
1069 spin_unlock_irqrestore(&priv->tx_lock, flags); 1062 spin_unlock_irq(&priv->tx_lock);
1070} 1063}
1071 1064
1072void ipoib_cm_skb_too_long(struct net_device* dev, struct sk_buff *skb, 1065void ipoib_cm_skb_too_long(struct net_device* dev, struct sk_buff *skb,
@@ -1088,9 +1081,8 @@ static void ipoib_cm_stale_task(struct work_struct *work)
1088 struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, 1081 struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv,
1089 cm.stale_task.work); 1082 cm.stale_task.work);
1090 struct ipoib_cm_rx *p; 1083 struct ipoib_cm_rx *p;
1091 unsigned long flags;
1092 1084
1093 spin_lock_irqsave(&priv->lock, flags); 1085 spin_lock_irq(&priv->lock);
1094 while (!list_empty(&priv->cm.passive_ids)) { 1086 while (!list_empty(&priv->cm.passive_ids)) {
1095 /* List if sorted by LRU, start from tail, 1087 /* List if sorted by LRU, start from tail,
1096 * stop when we see a recently used entry */ 1088 * stop when we see a recently used entry */
@@ -1098,13 +1090,13 @@ static void ipoib_cm_stale_task(struct work_struct *work)
1098 if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT)) 1090 if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT))
1099 break; 1091 break;
1100 list_del_init(&p->list); 1092 list_del_init(&p->list);
1101 spin_unlock_irqrestore(&priv->lock, flags); 1093 spin_unlock_irq(&priv->lock);
1102 ib_destroy_cm_id(p->id); 1094 ib_destroy_cm_id(p->id);
1103 ib_destroy_qp(p->qp); 1095 ib_destroy_qp(p->qp);
1104 kfree(p); 1096 kfree(p);
1105 spin_lock_irqsave(&priv->lock, flags); 1097 spin_lock_irq(&priv->lock);
1106 } 1098 }
1107 spin_unlock_irqrestore(&priv->lock, flags); 1099 spin_unlock_irq(&priv->lock);
1108} 1100}
1109 1101
1110 1102
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 93f74567897e..1bdb9101911a 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -172,8 +172,8 @@ static void ipoib_ib_handle_rx_wc(struct net_device *dev, struct ib_wc *wc)
172 struct sk_buff *skb; 172 struct sk_buff *skb;
173 u64 addr; 173 u64 addr;
174 174
175 ipoib_dbg_data(priv, "recv completion: id %d, op %d, status: %d\n", 175 ipoib_dbg_data(priv, "recv completion: id %d, status: %d\n",
176 wr_id, wc->opcode, wc->status); 176 wr_id, wc->status);
177 177
178 if (unlikely(wr_id >= ipoib_recvq_size)) { 178 if (unlikely(wr_id >= ipoib_recvq_size)) {
179 ipoib_warn(priv, "recv completion event with wrid %d (> %d)\n", 179 ipoib_warn(priv, "recv completion event with wrid %d (> %d)\n",
@@ -245,8 +245,8 @@ static void ipoib_ib_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
245 struct ipoib_tx_buf *tx_req; 245 struct ipoib_tx_buf *tx_req;
246 unsigned long flags; 246 unsigned long flags;
247 247
248 ipoib_dbg_data(priv, "send completion: id %d, op %d, status: %d\n", 248 ipoib_dbg_data(priv, "send completion: id %d, status: %d\n",
249 wr_id, wc->opcode, wc->status); 249 wr_id, wc->status);
250 250
251 if (unlikely(wr_id >= ipoib_sendq_size)) { 251 if (unlikely(wr_id >= ipoib_sendq_size)) {
252 ipoib_warn(priv, "send completion event with wrid %d (> %d)\n", 252 ipoib_warn(priv, "send completion event with wrid %d (> %d)\n",
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index f2a40ae8e7d0..b4c380c5a3ba 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -395,14 +395,10 @@ static void path_rec_completion(int status,
395 skb_queue_head_init(&skqueue); 395 skb_queue_head_init(&skqueue);
396 396
397 if (!status) { 397 if (!status) {
398 struct ib_ah_attr av = { 398 struct ib_ah_attr av;
399 .dlid = be16_to_cpu(pathrec->dlid), 399
400 .sl = pathrec->sl, 400 if (!ib_init_ah_from_path(priv->ca, priv->port, pathrec, &av))
401 .port_num = priv->port, 401 ah = ipoib_create_ah(dev, priv->pd, &av);
402 .static_rate = pathrec->rate
403 };
404
405 ah = ipoib_create_ah(dev, priv->pd, &av);
406 } 402 }
407 403
408 spin_lock_irqsave(&priv->lock, flags); 404 spin_lock_irqsave(&priv->lock, flags);