Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma

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

Changed files
+76 -62
drivers
+3 -2
drivers/infiniband/core/cm.c
··· 3651 3651 struct ib_cm_sidr_rep_param *param) 3652 3652 { 3653 3653 struct ib_mad_send_buf *msg; 3654 + unsigned long flags; 3654 3655 int ret; 3655 3656 3656 3657 lockdep_assert_held(&cm_id_priv->lock); ··· 3677 3676 return ret; 3678 3677 } 3679 3678 cm_id_priv->id.state = IB_CM_IDLE; 3680 - spin_lock_irq(&cm.lock); 3679 + spin_lock_irqsave(&cm.lock, flags); 3681 3680 if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node)) { 3682 3681 rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table); 3683 3682 RB_CLEAR_NODE(&cm_id_priv->sidr_id_node); 3684 3683 } 3685 - spin_unlock_irq(&cm.lock); 3684 + spin_unlock_irqrestore(&cm.lock, flags); 3686 3685 return 0; 3687 3686 } 3688 3687
+1 -1
drivers/infiniband/core/uverbs_ioctl.c
··· 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 95 * @bundle: The bundle 96 96 * @size: Number of bytes to allocate 97 97 * @flags: Allocator flags
+3 -1
drivers/infiniband/hw/mlx5/devx.c
··· 2073 2073 2074 2074 num_alloc_xa_entries++; 2075 2075 event_sub = kzalloc(sizeof(*event_sub), GFP_KERNEL); 2076 - if (!event_sub) 2076 + if (!event_sub) { 2077 + err = -ENOMEM; 2077 2078 goto err; 2079 + } 2078 2080 2079 2081 list_add_tail(&event_sub->event_list, &sub_list); 2080 2082 uverbs_uobject_get(&ev_file->uobj);
+1 -1
drivers/infiniband/hw/mlx5/odp.c
··· 1082 1082 return ret ? ret : npages; 1083 1083 } 1084 1084 1085 - /** 1085 + /* 1086 1086 * Parse a series of data segments for page fault handling. 1087 1087 * 1088 1088 * @dev: Pointer to mlx5 IB device
+1
drivers/infiniband/sw/rxe/Kconfig
··· 4 4 depends on INET && PCI && INFINIBAND 5 5 depends on INFINIBAND_VIRT_DMA 6 6 select NET_UDP_TUNNEL 7 + select CRYPTO 7 8 select CRYPTO_CRC32 8 9 help 9 10 This driver implements the InfiniBand RDMA transport over
+23 -32
drivers/infiniband/sw/rxe/rxe_comp.c
··· 547 547 struct sk_buff *skb = NULL; 548 548 struct rxe_pkt_info *pkt = NULL; 549 549 enum comp_state state; 550 + int ret = 0; 550 551 551 552 rxe_add_ref(qp); 552 553 ··· 555 554 qp->req.state == QP_STATE_RESET) { 556 555 rxe_drain_resp_pkts(qp, qp->valid && 557 556 qp->req.state == QP_STATE_ERROR); 558 - goto exit; 557 + ret = -EAGAIN; 558 + goto done; 559 559 } 560 560 561 561 if (qp->comp.timeout) { ··· 566 564 qp->comp.timeout_retry = 0; 567 565 } 568 566 569 - if (qp->req.need_retry) 570 - goto exit; 567 + if (qp->req.need_retry) { 568 + ret = -EAGAIN; 569 + goto done; 570 + } 571 571 572 572 state = COMPST_GET_ACK; 573 573 ··· 640 636 break; 641 637 642 638 case COMPST_DONE: 643 - if (pkt) 644 - free_pkt(pkt); 645 639 goto done; 646 640 647 641 case COMPST_EXIT: ··· 662 660 qp->qp_timeout_jiffies) 663 661 mod_timer(&qp->retrans_timer, 664 662 jiffies + qp->qp_timeout_jiffies); 665 - goto exit; 663 + ret = -EAGAIN; 664 + goto done; 666 665 667 666 case COMPST_ERROR_RETRY: 668 667 /* we come here if the retry timer fired and we did ··· 675 672 */ 676 673 677 674 /* there is nothing to retry in this case */ 678 - if (!wqe || (wqe->state == wqe_state_posted)) 679 - goto exit; 675 + if (!wqe || (wqe->state == wqe_state_posted)) { 676 + pr_warn("Retry attempted without a valid wqe\n"); 677 + ret = -EAGAIN; 678 + goto done; 679 + } 680 680 681 681 /* if we've started a retry, don't start another 682 682 * retry sequence, unless this is a timeout. 683 683 */ 684 684 if (qp->comp.started_retry && 685 - !qp->comp.timeout_retry) { 686 - if (pkt) 687 - free_pkt(pkt); 685 + !qp->comp.timeout_retry) 688 686 goto done; 689 - } 690 687 691 688 if (qp->comp.retry_cnt > 0) { 692 689 if (qp->comp.retry_cnt != 7) ··· 707 704 qp->comp.started_retry = 1; 708 705 rxe_run_task(&qp->req.task, 0); 709 706 } 710 - if (pkt) 711 - free_pkt(pkt); 712 707 goto done; 713 708 714 709 } else { ··· 727 726 mod_timer(&qp->rnr_nak_timer, 728 727 jiffies + rnrnak_jiffies(aeth_syn(pkt) 729 728 & ~AETH_TYPE_MASK)); 730 - free_pkt(pkt); 731 - goto exit; 729 + ret = -EAGAIN; 730 + goto done; 732 731 } else { 733 732 rxe_counter_inc(rxe, 734 733 RXE_CNT_RNR_RETRY_EXCEEDED); ··· 741 740 WARN_ON_ONCE(wqe->status == IB_WC_SUCCESS); 742 741 do_complete(qp, wqe); 743 742 rxe_qp_error(qp); 744 - if (pkt) 745 - free_pkt(pkt); 746 - goto exit; 743 + ret = -EAGAIN; 744 + goto done; 747 745 } 748 746 } 749 747 750 - exit: 751 - /* we come here if we are done with processing and want the task to 752 - * exit from the loop calling us 753 - */ 754 - WARN_ON_ONCE(skb); 755 - rxe_drop_ref(qp); 756 - return -EAGAIN; 757 - 758 748 done: 759 - /* we come here if we have processed a packet we want the task to call 760 - * us again to see if there is anything else to do 761 - */ 762 - WARN_ON_ONCE(skb); 749 + if (pkt) 750 + free_pkt(pkt); 763 751 rxe_drop_ref(qp); 764 - return 0; 752 + 753 + return ret; 765 754 }
+9 -1
drivers/infiniband/sw/rxe/rxe_net.c
··· 407 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 413 void rxe_loopback(struct sk_buff *skb) 411 414 { 415 + struct rxe_pkt_info *pkt = SKB_TO_PKT(skb); 416 + 412 417 if (skb->protocol == htons(ETH_P_IP)) 413 418 skb_pull(skb, sizeof(struct iphdr)); 414 419 else 415 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 428 struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
+35 -24
drivers/infiniband/sw/rxe/rxe_recv.c
··· 237 237 struct rxe_mc_elem *mce; 238 238 struct rxe_qp *qp; 239 239 union ib_gid dgid; 240 - struct sk_buff *per_qp_skb; 241 - struct rxe_pkt_info *per_qp_pkt; 242 240 int err; 243 241 244 242 if (skb->protocol == htons(ETH_P_IP)) ··· 248 250 /* lookup mcast group corresponding to mgid, takes a ref */ 249 251 mcg = rxe_pool_get_key(&rxe->mc_grp_pool, &dgid); 250 252 if (!mcg) 251 - goto err1; /* mcast group not registered */ 253 + goto drop; /* mcast group not registered */ 252 254 253 255 spin_lock_bh(&mcg->mcg_lock); 254 256 257 + /* this is unreliable datagram service so we let 258 + * failures to deliver a multicast packet to a 259 + * single QP happen and just move on and try 260 + * the rest of them on the list 261 + */ 255 262 list_for_each_entry(mce, &mcg->qp_list, qp_list) { 256 263 qp = mce->qp; 257 264 ··· 269 266 if (err) 270 267 continue; 271 268 272 - /* for all but the last qp create a new clone of the 273 - * skb and pass to the qp. If an error occurs in the 274 - * checks for the last qp in the list we need to 275 - * free the skb since it hasn't been passed on to 276 - * rxe_rcv_pkt() which would free it later. 269 + /* for all but the last QP create a new clone of the 270 + * skb and pass to the QP. Pass the original skb to 271 + * the last QP in the list. 277 272 */ 278 273 if (mce->qp_list.next != &mcg->qp_list) { 279 - per_qp_skb = skb_clone(skb, GFP_ATOMIC); 280 - if (WARN_ON(!ib_device_try_get(&rxe->ib_dev))) { 281 - kfree_skb(per_qp_skb); 274 + struct sk_buff *cskb; 275 + struct rxe_pkt_info *cpkt; 276 + 277 + cskb = skb_clone(skb, GFP_ATOMIC); 278 + if (unlikely(!cskb)) 282 279 continue; 280 + 281 + if (WARN_ON(!ib_device_try_get(&rxe->ib_dev))) { 282 + kfree_skb(cskb); 283 + break; 283 284 } 285 + 286 + cpkt = SKB_TO_PKT(cskb); 287 + cpkt->qp = qp; 288 + rxe_add_ref(qp); 289 + rxe_rcv_pkt(cpkt, cskb); 284 290 } else { 285 - per_qp_skb = skb; 286 - /* show we have consumed the skb */ 287 - skb = NULL; 291 + pkt->qp = qp; 292 + rxe_add_ref(qp); 293 + rxe_rcv_pkt(pkt, skb); 294 + skb = NULL; /* mark consumed */ 288 295 } 289 - 290 - if (unlikely(!per_qp_skb)) 291 - continue; 292 - 293 - per_qp_pkt = SKB_TO_PKT(per_qp_skb); 294 - per_qp_pkt->qp = qp; 295 - rxe_add_ref(qp); 296 - rxe_rcv_pkt(per_qp_pkt, per_qp_skb); 297 296 } 298 297 299 298 spin_unlock_bh(&mcg->mcg_lock); 300 299 301 300 rxe_drop_ref(mcg); /* drop ref from rxe_pool_get_key. */ 302 301 303 - err1: 304 - /* free skb if not consumed */ 302 + if (likely(!skb)) 303 + return; 304 + 305 + /* This only occurs if one of the checks fails on the last 306 + * QP in the list above 307 + */ 308 + 309 + drop: 305 310 kfree_skb(skb); 306 311 ib_device_put(&rxe->ib_dev); 307 312 }