.. | .. |
---|
174 | 174 | rcu_read_lock(); |
---|
175 | 175 | in = __in_dev_get_rcu(upper_dev); |
---|
176 | 176 | |
---|
177 | | - if (!in->ifa_list) |
---|
178 | | - local_ipaddr = 0; |
---|
179 | | - else |
---|
180 | | - local_ipaddr = ntohl(in->ifa_list->ifa_address); |
---|
| 177 | + local_ipaddr = 0; |
---|
| 178 | + if (in) { |
---|
| 179 | + struct in_ifaddr *ifa; |
---|
| 180 | + |
---|
| 181 | + ifa = rcu_dereference(in->ifa_list); |
---|
| 182 | + if (ifa) |
---|
| 183 | + local_ipaddr = ntohl(ifa->ifa_address); |
---|
| 184 | + } |
---|
181 | 185 | |
---|
182 | 186 | rcu_read_unlock(); |
---|
183 | 187 | } else { |
---|
.. | .. |
---|
186 | 190 | switch (event) { |
---|
187 | 191 | case NETDEV_DOWN: |
---|
188 | 192 | action = I40IW_ARP_DELETE; |
---|
189 | | - /* Fall through */ |
---|
| 193 | + fallthrough; |
---|
190 | 194 | case NETDEV_UP: |
---|
191 | | - /* Fall through */ |
---|
192 | 195 | case NETDEV_CHANGEADDR: |
---|
193 | 196 | |
---|
194 | 197 | /* Just skip if no need to handle ARP cache */ |
---|
.. | .. |
---|
243 | 246 | switch (event) { |
---|
244 | 247 | case NETDEV_DOWN: |
---|
245 | 248 | action = I40IW_ARP_DELETE; |
---|
246 | | - /* Fall through */ |
---|
| 249 | + fallthrough; |
---|
247 | 250 | case NETDEV_UP: |
---|
248 | | - /* Fall through */ |
---|
249 | 251 | case NETDEV_CHANGEADDR: |
---|
250 | 252 | i40iw_manage_arp_cache(iwdev, |
---|
251 | 253 | netdev->dev_addr, |
---|
.. | .. |
---|
340 | 342 | switch (event) { |
---|
341 | 343 | case NETDEV_DOWN: |
---|
342 | 344 | iwdev->iw_status = 0; |
---|
343 | | - /* Fall through */ |
---|
| 345 | + fallthrough; |
---|
344 | 346 | case NETDEV_UP: |
---|
345 | 347 | i40iw_port_ibevent(iwdev); |
---|
346 | 348 | break; |
---|
.. | .. |
---|
476 | 478 | } |
---|
477 | 479 | |
---|
478 | 480 | /** |
---|
479 | | - * i40iw_free_qp - callback after destroy cqp completes |
---|
480 | | - * @cqp_request: cqp request for destroy qp |
---|
481 | | - * @num: not used |
---|
482 | | - */ |
---|
483 | | -static void i40iw_free_qp(struct i40iw_cqp_request *cqp_request, u32 num) |
---|
484 | | -{ |
---|
485 | | - struct i40iw_sc_qp *qp = (struct i40iw_sc_qp *)cqp_request->param; |
---|
486 | | - struct i40iw_qp *iwqp = (struct i40iw_qp *)qp->back_qp; |
---|
487 | | - struct i40iw_device *iwdev; |
---|
488 | | - u32 qp_num = iwqp->ibqp.qp_num; |
---|
489 | | - |
---|
490 | | - iwdev = iwqp->iwdev; |
---|
491 | | - |
---|
492 | | - i40iw_rem_pdusecount(iwqp->iwpd, iwdev); |
---|
493 | | - i40iw_free_qp_resources(iwdev, iwqp, qp_num); |
---|
494 | | - i40iw_rem_devusecount(iwdev); |
---|
495 | | -} |
---|
496 | | - |
---|
497 | | -/** |
---|
498 | 481 | * i40iw_wait_event - wait for completion |
---|
499 | 482 | * @iwdev: iwarp device |
---|
500 | 483 | * @cqp_request: cqp request to wait |
---|
.. | .. |
---|
611 | 594 | if (!atomic_dec_and_test(&iwpd->usecount)) |
---|
612 | 595 | return; |
---|
613 | 596 | i40iw_free_resource(iwdev, iwdev->allocated_pds, iwpd->sc_pd.pd_id); |
---|
614 | | - kfree(iwpd); |
---|
615 | 597 | } |
---|
616 | 598 | |
---|
617 | 599 | /** |
---|
618 | | - * i40iw_add_ref - add refcount for qp |
---|
| 600 | + * i40iw_qp_add_ref - add refcount for qp |
---|
619 | 601 | * @ibqp: iqarp qp |
---|
620 | 602 | */ |
---|
621 | | -void i40iw_add_ref(struct ib_qp *ibqp) |
---|
| 603 | +void i40iw_qp_add_ref(struct ib_qp *ibqp) |
---|
622 | 604 | { |
---|
623 | 605 | struct i40iw_qp *iwqp = (struct i40iw_qp *)ibqp; |
---|
624 | 606 | |
---|
625 | | - atomic_inc(&iwqp->refcount); |
---|
| 607 | + refcount_inc(&iwqp->refcount); |
---|
626 | 608 | } |
---|
627 | 609 | |
---|
628 | 610 | /** |
---|
629 | | - * i40iw_rem_ref - rem refcount for qp and free if 0 |
---|
| 611 | + * i40iw_qp_rem_ref - rem refcount for qp and free if 0 |
---|
630 | 612 | * @ibqp: iqarp qp |
---|
631 | 613 | */ |
---|
632 | | -void i40iw_rem_ref(struct ib_qp *ibqp) |
---|
| 614 | +void i40iw_qp_rem_ref(struct ib_qp *ibqp) |
---|
633 | 615 | { |
---|
634 | 616 | struct i40iw_qp *iwqp; |
---|
635 | | - enum i40iw_status_code status; |
---|
636 | | - struct i40iw_cqp_request *cqp_request; |
---|
637 | | - struct cqp_commands_info *cqp_info; |
---|
638 | 617 | struct i40iw_device *iwdev; |
---|
639 | 618 | u32 qp_num; |
---|
640 | 619 | unsigned long flags; |
---|
.. | .. |
---|
642 | 621 | iwqp = to_iwqp(ibqp); |
---|
643 | 622 | iwdev = iwqp->iwdev; |
---|
644 | 623 | spin_lock_irqsave(&iwdev->qptable_lock, flags); |
---|
645 | | - if (!atomic_dec_and_test(&iwqp->refcount)) { |
---|
| 624 | + if (!refcount_dec_and_test(&iwqp->refcount)) { |
---|
646 | 625 | spin_unlock_irqrestore(&iwdev->qptable_lock, flags); |
---|
647 | 626 | return; |
---|
648 | 627 | } |
---|
.. | .. |
---|
650 | 629 | qp_num = iwqp->ibqp.qp_num; |
---|
651 | 630 | iwdev->qp_table[qp_num] = NULL; |
---|
652 | 631 | spin_unlock_irqrestore(&iwdev->qptable_lock, flags); |
---|
653 | | - cqp_request = i40iw_get_cqp_request(&iwdev->cqp, false); |
---|
654 | | - if (!cqp_request) |
---|
655 | | - return; |
---|
| 632 | + complete(&iwqp->free_qp); |
---|
656 | 633 | |
---|
657 | | - cqp_request->callback_fcn = i40iw_free_qp; |
---|
658 | | - cqp_request->param = (void *)&iwqp->sc_qp; |
---|
659 | | - cqp_info = &cqp_request->info; |
---|
660 | | - cqp_info->cqp_cmd = OP_QP_DESTROY; |
---|
661 | | - cqp_info->post_sq = 1; |
---|
662 | | - cqp_info->in.u.qp_destroy.qp = &iwqp->sc_qp; |
---|
663 | | - cqp_info->in.u.qp_destroy.scratch = (uintptr_t)cqp_request; |
---|
664 | | - cqp_info->in.u.qp_destroy.remove_hash_idx = true; |
---|
665 | | - status = i40iw_handle_cqp_op(iwdev, cqp_request); |
---|
666 | | - if (!status) |
---|
667 | | - return; |
---|
668 | | - |
---|
669 | | - i40iw_rem_pdusecount(iwqp->iwpd, iwdev); |
---|
670 | | - i40iw_free_qp_resources(iwdev, iwqp, qp_num); |
---|
671 | | - i40iw_rem_devusecount(iwdev); |
---|
672 | 634 | } |
---|
673 | 635 | |
---|
674 | 636 | /** |
---|
.. | .. |
---|
750 | 712 | u64 size, |
---|
751 | 713 | u32 alignment) |
---|
752 | 714 | { |
---|
753 | | - struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context; |
---|
| 715 | + struct pci_dev *pcidev = hw->pcidev; |
---|
754 | 716 | |
---|
755 | 717 | if (!mem) |
---|
756 | 718 | return I40IW_ERR_PARAM; |
---|
757 | 719 | mem->size = ALIGN(size, alignment); |
---|
758 | | - mem->va = dma_zalloc_coherent(&pcidev->dev, mem->size, |
---|
759 | | - (dma_addr_t *)&mem->pa, GFP_KERNEL); |
---|
| 720 | + mem->va = dma_alloc_coherent(&pcidev->dev, mem->size, |
---|
| 721 | + (dma_addr_t *)&mem->pa, GFP_KERNEL); |
---|
760 | 722 | if (!mem->va) |
---|
761 | 723 | return I40IW_ERR_NO_MEMORY; |
---|
762 | 724 | return 0; |
---|
.. | .. |
---|
769 | 731 | */ |
---|
770 | 732 | void i40iw_free_dma_mem(struct i40iw_hw *hw, struct i40iw_dma_mem *mem) |
---|
771 | 733 | { |
---|
772 | | - struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context; |
---|
| 734 | + struct pci_dev *pcidev = hw->pcidev; |
---|
773 | 735 | |
---|
774 | 736 | if (!mem || !mem->va) |
---|
775 | 737 | return; |
---|
.. | .. |
---|
935 | 897 | struct i40iw_sc_qp *qp = (struct i40iw_sc_qp *)&iwqp->sc_qp; |
---|
936 | 898 | |
---|
937 | 899 | i40iw_terminate_done(qp, 1); |
---|
938 | | - i40iw_rem_ref(&iwqp->ibqp); |
---|
| 900 | + i40iw_qp_rem_ref(&iwqp->ibqp); |
---|
939 | 901 | } |
---|
940 | 902 | |
---|
941 | 903 | /** |
---|
.. | .. |
---|
947 | 909 | struct i40iw_qp *iwqp; |
---|
948 | 910 | |
---|
949 | 911 | iwqp = (struct i40iw_qp *)qp->back_qp; |
---|
950 | | - i40iw_add_ref(&iwqp->ibqp); |
---|
| 912 | + i40iw_qp_add_ref(&iwqp->ibqp); |
---|
951 | 913 | timer_setup(&iwqp->terminate_timer, i40iw_terminate_timeout, 0); |
---|
952 | 914 | iwqp->terminate_timer.expires = jiffies + HZ; |
---|
953 | 915 | add_timer(&iwqp->terminate_timer); |
---|
.. | .. |
---|
963 | 925 | |
---|
964 | 926 | iwqp = (struct i40iw_qp *)qp->back_qp; |
---|
965 | 927 | if (del_timer(&iwqp->terminate_timer)) |
---|
966 | | - i40iw_rem_ref(&iwqp->ibqp); |
---|
| 928 | + i40iw_qp_rem_ref(&iwqp->ibqp); |
---|
967 | 929 | } |
---|
968 | 930 | |
---|
969 | 931 | /** |
---|