diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2018-09-05 18:21:22 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-09-05 18:21:22 -0400 |
commit | 2c910cb75e1fe6de52d95c8e32caedd1629a33a5 (patch) | |
tree | 94a0eea6f8cde689d11e7583ddd0a930b8785ab4 /drivers/net/ethernet/intel/ice/ice_controlq.c | |
parent | 627212c9d49ba2759b699450f5d8f45f73e062fa (diff) | |
parent | b53b1c08a23eb1091982daacb2122f90a7094a77 (diff) |
Merge branch 'uverbs_dev_cleanups' into rdma.git for-next
For dependencies, branch based on rdma.git 'for-rc' of
https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/
Pull 'uverbs_dev_cleanups' from Leon Romanovsky:
====================
Reuse the char device code interfaces to simplify ib_uverbs_device
creation and destruction. As part of this series, we are sending fix to
cleanup path, which was discovered during internal review,
The fix definitely can go to -rc, but it means that this series will be
dependent on rdma-rc.
====================
* branch 'uverbs_dev_cleanups':
RDMA/uverbs: Use device.groups to initialize device attributes
RDMA/uverbs: Use cdev_device_add() instead of cdev_add()
RDMA/core: Depend on device_add() to add device attributes
RDMA/uverbs: Fix error cleanup path of ib_uverbs_add_one()
Resolved conflict in ib_device_unregister_sysfs()
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_controlq.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_controlq.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.c b/drivers/net/ethernet/intel/ice/ice_controlq.c index 7c511f144ed6..62be72fdc8f3 100644 --- a/drivers/net/ethernet/intel/ice/ice_controlq.c +++ b/drivers/net/ethernet/intel/ice/ice_controlq.c | |||
@@ -597,10 +597,14 @@ static enum ice_status ice_init_check_adminq(struct ice_hw *hw) | |||
597 | return 0; | 597 | return 0; |
598 | 598 | ||
599 | init_ctrlq_free_rq: | 599 | init_ctrlq_free_rq: |
600 | ice_shutdown_rq(hw, cq); | 600 | if (cq->rq.head) { |
601 | ice_shutdown_sq(hw, cq); | 601 | ice_shutdown_rq(hw, cq); |
602 | mutex_destroy(&cq->sq_lock); | 602 | mutex_destroy(&cq->rq_lock); |
603 | mutex_destroy(&cq->rq_lock); | 603 | } |
604 | if (cq->sq.head) { | ||
605 | ice_shutdown_sq(hw, cq); | ||
606 | mutex_destroy(&cq->sq_lock); | ||
607 | } | ||
604 | return status; | 608 | return status; |
605 | } | 609 | } |
606 | 610 | ||
@@ -706,10 +710,14 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type) | |||
706 | return; | 710 | return; |
707 | } | 711 | } |
708 | 712 | ||
709 | ice_shutdown_sq(hw, cq); | 713 | if (cq->sq.head) { |
710 | ice_shutdown_rq(hw, cq); | 714 | ice_shutdown_sq(hw, cq); |
711 | mutex_destroy(&cq->sq_lock); | 715 | mutex_destroy(&cq->sq_lock); |
712 | mutex_destroy(&cq->rq_lock); | 716 | } |
717 | if (cq->rq.head) { | ||
718 | ice_shutdown_rq(hw, cq); | ||
719 | mutex_destroy(&cq->rq_lock); | ||
720 | } | ||
713 | } | 721 | } |
714 | 722 | ||
715 | /** | 723 | /** |
@@ -1057,8 +1065,11 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq, | |||
1057 | 1065 | ||
1058 | clean_rq_elem_out: | 1066 | clean_rq_elem_out: |
1059 | /* Set pending if needed, unlock and return */ | 1067 | /* Set pending if needed, unlock and return */ |
1060 | if (pending) | 1068 | if (pending) { |
1069 | /* re-read HW head to calculate actual pending messages */ | ||
1070 | ntu = (u16)(rd32(hw, cq->rq.head) & cq->rq.head_mask); | ||
1061 | *pending = (u16)((ntc > ntu ? cq->rq.count : 0) + (ntu - ntc)); | 1071 | *pending = (u16)((ntc > ntu ? cq->rq.count : 0) + (ntu - ntc)); |
1072 | } | ||
1062 | clean_rq_elem_err: | 1073 | clean_rq_elem_err: |
1063 | mutex_unlock(&cq->rq_lock); | 1074 | mutex_unlock(&cq->rq_lock); |
1064 | 1075 | ||