Pull rdma fixes from Jason Gunthorpe: "Nothing special here, though Bob's regression fixes for rxe would have made it before the rc cycle had there not been such strong winter weather! - Fix corner cases in the rxe reference counting cleanup that are causing regressions in blktests for SRP - Two kdoc fixes so W=1 is clean - Missing error return in error unwind for mlx5 - Wrong lock type nesting in IB CM" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/rxe: Fix errant WARN_ONCE in rxe_completer() RDMA/rxe: Fix extra deref in rxe_rcv_mcast_pkt() RDMA/rxe: Fix missed IB reference counting in loopback RDMA/uverbs: Fix kernel-doc warning of _uverbs_alloc RDMA/mlx5: Set correct kernel-doc identifier IB/mlx5: Add missing error code RDMA/rxe: Fix missing kconfig dependency on CRYPTO RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep
Unified · Split
| @@ -3651,6 +3651,7 @@ static int cm_send_sidr_rep_locked(struct cm_id_private *cm_id_priv, · 3650 unmodified lines | |||
| 3651 | struct ib_cm_sidr_rep_param *param) | 3651 | struct ib_cm_sidr_rep_param *param) |
| 3652 | { | 3652 | { |
| 3653 | struct ib_mad_send_buf *msg; | 3653 | struct ib_mad_send_buf *msg; |
| 3654 | unsigned long flags; | ||
| 3654 | int ret; | 3655 | int ret; |
| 3655 | 3656 | ||
| 3656 | lockdep_assert_held(&cm_id_priv->lock); | 3657 | lockdep_assert_held(&cm_id_priv->lock); |
| @@ -3676,12 +3677,12 @@ static int cm_send_sidr_rep_locked(struct cm_id_private *cm_id_priv, · 19 unmodified lines | |||
| 3676 | return ret; | 3677 | return ret; |
| 3677 | } | 3678 | } |
| 3678 | cm_id_priv->id.state = IB_CM_IDLE; | 3679 | cm_id_priv->id.state = IB_CM_IDLE; |
| 3679 | spin_lock_irq(&cm.lock); | 3680 | spin_lock_irqsave(&cm.lock, flags); |
| 3680 | if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node)) { | 3681 | if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node)) { |
| 3681 | rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table); | 3682 | rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table); |
| 3682 | RB_CLEAR_NODE(&cm_id_priv->sidr_id_node); | 3683 | RB_CLEAR_NODE(&cm_id_priv->sidr_id_node); |
| 3683 | } | 3684 | } |
| 3684 | spin_unlock_irq(&cm.lock); | 3685 | spin_unlock_irqrestore(&cm.lock, flags); |
| 3685 | return 0; | 3686 | return 0; |
| 3686 | } | 3687 | } |
| 3687 | 3688 | ||
| @@ -91,7 +91,7 @@ void uapi_compute_bundle_size(struct uverbs_api_ioctl_method *method_elm, · 90 unmodified lines | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | /** | 93 | /** |
| 94 | * uverbs_alloc() - Quickly allocate memory for use with a bundle | 94 | * _uverbs_alloc() - Quickly allocate memory for use with a bundle |
| 95 | * @bundle: The bundle | 95 | * @bundle: The bundle |
| 96 | * @size: Number of bytes to allocate | 96 | * @size: Number of bytes to allocate |
| 97 | * @flags: Allocator flags | 97 | * @flags: Allocator flags |
| @@ -2073,8 +2073,10 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT)( · 2072 unmodified lines | |||
| 2073 | 2073 | ||
| 2074 | num_alloc_xa_entries++; | 2074 | num_alloc_xa_entries++; |
| 2075 | event_sub = kzalloc(sizeof(*event_sub), GFP_KERNEL); | 2075 | event_sub = kzalloc(sizeof(*event_sub), GFP_KERNEL); |
| 2076 | if (!event_sub) | 2076 | if (!event_sub) { |
| 2077 | err = -ENOMEM; | ||
| 2077 | goto err; | 2078 | goto err; |
| 2079 | } | ||
| 2078 | 2080 | ||
| 2079 | list_add_tail(&event_sub->event_list, &sub_list); | 2081 | list_add_tail(&event_sub->event_list, &sub_list); |
| 2080 | uverbs_uobject_get(&ev_file->uobj); | 2082 | uverbs_uobject_get(&ev_file->uobj); |
| @@ -1082,7 +1082,7 @@ end: · 1081 unmodified lines | |||
| 1082 | return ret ? ret : npages; | 1082 | return ret ? ret : npages; |
| 1083 | } | 1083 | } |
| 1084 | 1084 | ||
| 1085 | /** | 1085 | /* |
| 1086 | * Parse a series of data segments for page fault handling. | 1086 | * Parse a series of data segments for page fault handling. |
| 1087 | * | 1087 | * |
| 1088 | * @dev: Pointer to mlx5 IB device | 1088 | * @dev: Pointer to mlx5 IB device |
| @@ -4,6 +4,7 @@ config RDMA_RXE · 3 unmodified lines | |||
| 4 | depends on INET && PCI && INFINIBAND | 4 | depends on INET && PCI && INFINIBAND |
| 5 | depends on INFINIBAND_VIRT_DMA | 5 | depends on INFINIBAND_VIRT_DMA |
| 6 | select NET_UDP_TUNNEL | 6 | select NET_UDP_TUNNEL |
| 7 | select CRYPTO | ||
| 7 | select CRYPTO_CRC32 | 8 | select CRYPTO_CRC32 |
| 8 | help | 9 | help |
| 9 | This driver implements the InfiniBand RDMA transport over | 10 | This driver implements the InfiniBand RDMA transport over |
| @@ -547,6 +547,7 @@ int rxe_completer(void *arg) · 546 unmodified lines | |||
| 547 | struct sk_buff *skb = NULL; | 547 | struct sk_buff *skb = NULL; |
| 548 | struct rxe_pkt_info *pkt = NULL; | 548 | struct rxe_pkt_info *pkt = NULL; |
| 549 | enum comp_state state; | 549 | enum comp_state state; |
| 550 | int ret = 0; | ||
| 550 | 551 | ||
| 551 | rxe_add_ref(qp); | 552 | rxe_add_ref(qp); |
| 552 | 553 | ||
| @@ -554,7 +555,8 @@ int rxe_completer(void *arg) · 1 unmodified line | |||
| 554 | qp->req.state == QP_STATE_RESET) { | 555 | qp->req.state == QP_STATE_RESET) { |
| 555 | rxe_drain_resp_pkts(qp, qp->valid && | 556 | rxe_drain_resp_pkts(qp, qp->valid && |
| 556 | qp->req.state == QP_STATE_ERROR); | 557 | qp->req.state == QP_STATE_ERROR); |
| 557 | goto exit; | 558 | ret = -EAGAIN; |
| 559 | goto done; | ||
| 558 | } | 560 | } |
| 559 | 561 | ||
| 560 | if (qp->comp.timeout) { | 562 | if (qp->comp.timeout) { |
| @@ -564,8 +566,10 @@ int rxe_completer(void *arg) · 3 unmodified lines | |||
| 564 | qp->comp.timeout_retry = 0; | 566 | qp->comp.timeout_retry = 0; |
| 565 | } | 567 | } |
| 566 | 568 | ||
| 567 | if (qp->req.need_retry) | 569 | if (qp->req.need_retry) { |
| 568 | goto exit; | 570 | ret = -EAGAIN; |
| 571 | goto done; | ||
| 572 | } | ||
| 569 | 573 | ||
| 570 | state = COMPST_GET_ACK; | 574 | state = COMPST_GET_ACK; |
| 571 | 575 | ||
| @@ -636,8 +640,6 @@ int rxe_completer(void *arg) · 64 unmodified lines | |||
| 636 | break; | 640 | break; |
| 637 | 641 | ||
| 638 | case COMPST_DONE: | 642 | case COMPST_DONE: |
| 639 | if (pkt) | ||
| 640 | free_pkt(pkt); | ||
| 641 | goto done; | 643 | goto done; |
| 642 | 644 | ||
| 643 | case COMPST_EXIT: | 645 | case COMPST_EXIT: |
| @@ -660,7 +662,8 @@ int rxe_completer(void *arg) · 16 unmodified lines | |||
| 660 | qp->qp_timeout_jiffies) | 662 | qp->qp_timeout_jiffies) |
| 661 | mod_timer(&qp->retrans_timer, | 663 | mod_timer(&qp->retrans_timer, |
| 662 | jiffies + qp->qp_timeout_jiffies); | 664 | jiffies + qp->qp_timeout_jiffies); |
| 663 | goto exit; | 665 | ret = -EAGAIN; |
| 666 | goto done; | ||
| 664 | 667 | ||
| 665 | case COMPST_ERROR_RETRY: | 668 | case COMPST_ERROR_RETRY: |
| 666 | /* we come here if the retry timer fired and we did | 669 | /* we come here if the retry timer fired and we did |
| @@ -672,18 +675,18 @@ int rxe_completer(void *arg) · 5 unmodified lines | |||
| 672 | */ | 675 | */ |
| 673 | 676 | ||
| 674 | /* there is nothing to retry in this case */ | 677 | /* there is nothing to retry in this case */ |
| 675 | if (!wqe || (wqe->state == wqe_state_posted)) | 678 | if (!wqe || (wqe->state == wqe_state_posted)) { |
| 676 | goto exit; | 679 | pr_warn("Retry attempted without a valid wqe\n"); |
| 680 | ret = -EAGAIN; | ||
| 681 | goto done; | ||
| 682 | } | ||
| 677 | 683 | ||
| 678 | /* if we've started a retry, don't start another | 684 | /* if we've started a retry, don't start another |
| 679 | * retry sequence, unless this is a timeout. | 685 | * retry sequence, unless this is a timeout. |
| 680 | */ | 686 | */ |
| 681 | if (qp->comp.started_retry && | 687 | if (qp->comp.started_retry && |
| 682 | !qp->comp.timeout_retry) { | 688 | !qp->comp.timeout_retry) |
| 683 | if (pkt) | ||
| 684 | free_pkt(pkt); | ||
| 685 | goto done; | 689 | goto done; |
| 686 | } | ||
| 687 | 690 | ||
| 688 | if (qp->comp.retry_cnt > 0) { | 691 | if (qp->comp.retry_cnt > 0) { |
| 689 | if (qp->comp.retry_cnt != 7) | 692 | if (qp->comp.retry_cnt != 7) |
| @@ -704,8 +707,6 @@ int rxe_completer(void *arg) · 14 unmodified lines | |||
| 704 | qp->comp.started_retry = 1; | 707 | qp->comp.started_retry = 1; |
| 705 | rxe_run_task(&qp->req.task, 0); | 708 | rxe_run_task(&qp->req.task, 0); |
| 706 | } | 709 | } |
| 707 | if (pkt) | ||
| 708 | free_pkt(pkt); | ||
| 709 | goto done; | 710 | goto done; |
| 710 | 711 | ||
| 711 | } else { | 712 | } else { |
| @@ -726,8 +727,8 @@ int rxe_completer(void *arg) · 14 unmodified lines | |||
| 726 | mod_timer(&qp->rnr_nak_timer, | 727 | mod_timer(&qp->rnr_nak_timer, |
| 727 | jiffies + rnrnak_jiffies(aeth_syn(pkt) | 728 | jiffies + rnrnak_jiffies(aeth_syn(pkt) |
| 728 | & ~AETH_TYPE_MASK)); | 729 | & ~AETH_TYPE_MASK)); |
| 729 | free_pkt(pkt); | 730 | ret = -EAGAIN; |
| 730 | goto exit; | 731 | goto done; |
| 731 | } else { | 732 | } else { |
| 732 | rxe_counter_inc(rxe, | 733 | rxe_counter_inc(rxe, |
| 733 | RXE_CNT_RNR_RETRY_EXCEEDED); | 734 | RXE_CNT_RNR_RETRY_EXCEEDED); |
| @@ -740,25 +741,15 @@ int rxe_completer(void *arg) · 6 unmodified lines | |||
| 740 | WARN_ON_ONCE(wqe->status == IB_WC_SUCCESS); | 741 | WARN_ON_ONCE(wqe->status == IB_WC_SUCCESS); |
| 741 | do_complete(qp, wqe); | 742 | do_complete(qp, wqe); |
| 742 | rxe_qp_error(qp); | 743 | rxe_qp_error(qp); |
| 743 | if (pkt) | 744 | ret = -EAGAIN; |
| 744 | free_pkt(pkt); | 745 | goto done; |
| 745 | goto exit; | ||
| 746 | } | 746 | } |
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | exit: | ||
| 750 | /* we come here if we are done with processing and want the task to | ||
| 751 | * exit from the loop calling us | ||
| 752 | */ | ||
| 753 | WARN_ON_ONCE(skb); | ||
| 754 | rxe_drop_ref(qp); | ||
| 755 | return -EAGAIN; | ||
| 756 | |||
| 757 | done: | 749 | done: |
| 758 | /* we come here if we have processed a packet we want the task to call | 750 | if (pkt) |
| 759 | * us again to see if there is anything else to do | 751 | free_pkt(pkt); |
| 760 | */ | ||
| 761 | WARN_ON_ONCE(skb); | ||
| 762 | rxe_drop_ref(qp); | 752 | rxe_drop_ref(qp); |
| 763 | return 0; | 753 | |
| 754 | return ret; | ||
| 764 | } | 755 | } |
| @@ -407,14 +407,22 @@ int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb) · 406 unmodified lines | |||
| 407 | return 0; | 407 | return 0; |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | /* fix up a send packet to match the packets | ||
| 411 | * received from UDP before looping them back | ||
| 412 | */ | ||
| 410 | void rxe_loopback(struct sk_buff *skb) | 413 | void rxe_loopback(struct sk_buff *skb) |
| 411 | { | 414 | { |
| 415 | struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); | ||
| 416 | |||
| 412 | if (skb->protocol == htons(ETH_P_IP)) | 417 | if (skb->protocol == htons(ETH_P_IP)) |
| 413 | skb_pull(skb, sizeof(struct iphdr)); | 418 | skb_pull(skb, sizeof(struct iphdr)); |
| 414 | else | 419 | else |
| 415 | skb_pull(skb, sizeof(struct ipv6hdr)); | 420 | skb_pull(skb, sizeof(struct ipv6hdr)); |
| 416 | 421 | ||
| 417 | rxe_rcv(skb); | 422 | if (WARN_ON(!ib_device_try_get(&pkt->rxe->ib_dev))) |
| 423 | kfree_skb(skb); | ||
| 424 | else | ||
| 425 | rxe_rcv(skb); | ||
| 418 | } | 426 | } |
| 419 | 427 | ||
| 420 | struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av, | 428 | struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av, |
| @@ -237,8 +237,6 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 236 unmodified lines | |||
| 237 | struct rxe_mc_elem *mce; | 237 | struct rxe_mc_elem *mce; |
| 238 | struct rxe_qp *qp; | 238 | struct rxe_qp *qp; |
| 239 | union ib_gid dgid; | 239 | union ib_gid dgid; |
| 240 | struct sk_buff *per_qp_skb; | ||
| 241 | struct rxe_pkt_info *per_qp_pkt; | ||
| 242 | int err; | 240 | int err; |
| 243 | 241 | ||
| 244 | if (skb->protocol == htons(ETH_P_IP)) | 242 | if (skb->protocol == htons(ETH_P_IP)) |
| @@ -250,10 +248,15 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 5 unmodified lines | |||
| 250 | /* lookup mcast group corresponding to mgid, takes a ref */ | 248 | /* lookup mcast group corresponding to mgid, takes a ref */ |
| 251 | mcg = rxe_pool_get_key(&rxe->mc_grp_pool, &dgid); | 249 | mcg = rxe_pool_get_key(&rxe->mc_grp_pool, &dgid); |
| 252 | if (!mcg) | 250 | if (!mcg) |
| 253 | goto err1; /* mcast group not registered */ | 251 | goto drop; /* mcast group not registered */ |
| 254 | 252 | ||
| 255 | spin_lock_bh(&mcg->mcg_lock); | 253 | spin_lock_bh(&mcg->mcg_lock); |
| 256 | 254 | ||
| 255 | /* this is unreliable datagram service so we let | ||
| 256 | * failures to deliver a multicast packet to a | ||
| 257 | * single QP happen and just move on and try | ||
| 258 | * the rest of them on the list | ||
| 259 | */ | ||
| 257 | list_for_each_entry(mce, &mcg->qp_list, qp_list) { | 260 | list_for_each_entry(mce, &mcg->qp_list, qp_list) { |
| 258 | qp = mce->qp; | 261 | qp = mce->qp; |
| 259 | 262 | ||
| @@ -266,39 +269,47 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) · 6 unmodified lines | |||
| 266 | if (err) | 269 | if (err) |
| 267 | continue; | 270 | continue; |
| 268 | 271 | ||
| 269 | /* for all but the last qp create a new clone of the | 272 | /* for all but the last QP create a new clone of the |
| 270 | * skb and pass to the qp. If an error occurs in the | 273 | * skb and pass to the QP. Pass the original skb to |
| 271 | * checks for the last qp in the list we need to | 274 | * the last QP in the list. |
| 272 | * free the skb since it hasn't been passed on to | ||
| 273 | * rxe_rcv_pkt() which would free it later. | ||
| 274 | */ | 275 | */ |
| 275 | if (mce->qp_list.next != &mcg->qp_list) { | 276 | if (mce->qp_list.next != &mcg->qp_list) { |
| 276 | per_qp_skb = skb_clone(skb, GFP_ATOMIC); | 277 | struct sk_buff *cskb; |
| 277 | if (WARN_ON(!ib_device_try_get(&rxe->ib_dev))) { | 278 | struct rxe_pkt_info *cpkt; |
| 278 | kfree_skb(per_qp_skb); | 279 | |
| 280 | cskb = skb_clone(skb, GFP_ATOMIC); | ||
| 281 | if (unlikely(!cskb)) | ||
| 279 | continue; | 282 | continue; |
| 283 | |||
| 284 | if (WARN_ON(!ib_device_try_get(&rxe->ib_dev))) { | ||
| 285 | kfree_skb(cskb); | ||
| 286 | break; | ||
| 280 | } | 287 | } |
| 288 | |||
| 289 | cpkt = SKB_TO_PKT(cskb); | ||
| 290 | cpkt->qp = qp; | ||
| 291 | rxe_add_ref(qp); | ||
| 292 | rxe_rcv_pkt(cpkt, cskb); | ||
| 281 | } else { | 293 | } else { |
| 282 | per_qp_skb = skb; | 294 | pkt->qp = qp; |
| 283 | /* show we have consumed the skb */ | 295 | rxe_add_ref(qp); |
| 284 | skb = NULL; | 296 | rxe_rcv_pkt(pkt, skb); |
| 297 | skb = NULL; /* mark consumed */ | ||
| 285 | } | 298 | } |
| 286 | |||
| 287 | if (unlikely(!per_qp_skb)) | ||
| 288 | continue; | ||
| 289 | |||
| 290 | per_qp_pkt = SKB_TO_PKT(per_qp_skb); | ||
| 291 | per_qp_pkt->qp = qp; | ||
| 292 | rxe_add_ref(qp); | ||
| 293 | rxe_rcv_pkt(per_qp_pkt, per_qp_skb); | ||
| 294 | } | 299 | } |
| 295 | 300 | ||
| 296 | spin_unlock_bh(&mcg->mcg_lock); | 301 | spin_unlock_bh(&mcg->mcg_lock); |
| 297 | 302 | ||
| 298 | rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */ | 303 | rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */ |
| 299 | 304 | ||
| 300 | err1: | 305 | if (likely(!skb)) |
| 301 | /* free skb if not consumed */ | 306 | return; |
| 307 | |||
| 308 | /* This only occurs if one of the checks fails on the last | ||
| 309 | * QP in the list above | ||
| 310 | */ | ||
| 311 | |||
| 312 | drop: | ||
| 302 | kfree_skb(skb); | 313 | kfree_skb(skb); |
| 303 | ib_device_put(&rxe->ib_dev); | 314 | ib_device_put(&rxe->ib_dev); |
| 304 | } | 315 | } |